rivantsov / vita

VITA Application Framework
MIT License
59 stars 15 forks source link

GUID with Auto #218

Closed rubenalves closed 1 year ago

rubenalves commented 1 year ago

Hello,

I have definitions o some classes like this

[PrimaryKey,Auto] Guid ID { get; set; } etc....

Id i assingn a new value, it gets override on save changes on create new entoty, is this by design or a eror no my code?

Thanks.

rivantsov commented 1 year ago

it is either Auto or not. If you put Auto, system assigns new Guid when you create new entity; NewEntity returns entity with this field already assigned. In this case you don't need the setter on the property, leave only '{get;}' . Without Auto, it is like regular property, your code is responsible for assigning new guid value - better do it immediately after you create it through NewEntity.