You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
Hi, I'm trying to create an entity with not-auto-generated primary key. To achieve that, I created an entity and modified the identity property to have an "Identity Type" of "Manual".
I expected to see this property being generated in the entity's constructor, since it's required and not-auto-generated. However, that's not what's happening. The generated class does not expose a way to set the value of the identity property: the property does not appear in the constructor and its setter is private.
As such, I cannot create entities of this type in my code.
/// <summary>/// Public constructor with required data/// </summary>/// <param name="name">Name of language in English</param>/// <param name="symbol">Currency symbol</param>publicCurrency(string name,string symbol){if(string.IsNullOrEmpty(name))thrownewArgumentNullException(nameof(name));this.Name=name;if(string.IsNullOrEmpty(symbol))thrownewArgumentNullException(nameof(symbol));this.Symbol=symbol;Init();}/// <summary>/// Static create function (for use in LINQ queries, etc.)/// </summary>/// <param name="name">Name of language in English</param>/// <param name="symbol">Currency symbol</param>publicstaticCurrencyCreate(stringname,stringsymbol){returnnewCurrency(name,symbol);}/************************************************************************* * Persistent properties *************************************************************************//// <summary>/// Identity, Required, Indexed, Min length = 3, Max length = 3/// Unique record identifier Examples: EUR; USD/// </summary>/// <remarks>/// Unique record identifier/// </remarks>[Key][Required][MaxLength(3)][StringLength(3)]publicstringCode{get; private set;}
The text was updated successfully, but these errors were encountered:
Each constructor calls the partial method Init which allows you to add constructor logic in a central location and have it execute in every constructor (note, though, that if you add your own constructors, you're on the hook for calling Init from that constructor as well :-) ). In the current version, this is typically where you would set the entity's identifier.
In the very-soon-to-be-released v1.3.0.5, though, manually-set identifiers have indeed been added to the public constructors. See #93 .
I gave compilation a quick shot but there were some problems. However I haven't yet read the Contributing article so I'm probably missing something. I'll leave that for another time since I have no urgency now.
Hi, I'm trying to create an entity with not-auto-generated primary key. To achieve that, I created an entity and modified the identity property to have an "Identity Type" of "Manual".
I expected to see this property being generated in the entity's constructor, since it's required and not-auto-generated. However, that's not what's happening. The generated class does not expose a way to set the value of the identity property: the property does not appear in the constructor and its setter is private.
As such, I cannot create entities of this type in my code.
Example
The text was updated successfully, but these errors were encountered: