Geeksltd / Olive

Olive framework, for more productive cross platform .NET solutions. It's available under the GPL v3 license. See License.md for more information.
https://geeksltd.github.io/Olive
Other
44 stars 44 forks source link

OriginalId is initialised to Guid.Empty() #238

Closed thapabhesh closed 5 years ago

thapabhesh commented 5 years ago

We have a scenario where a new object is saved and then subsequently the same object is updated based on some logic in a given transaction scope. In this case the Original ID is set to Guid.Empty() which does not update the entity itself second time.

var student = Database.Save(new Student{..});
.
// some other logic goes here
.
Database.Update(student, (s)=>...);

Update statemement sent to Database

exec sp_executesql N'UPDATE Students SET
                ...
                OUTPUT INSERTED.ID
                WHERE ID = @OriginalId',..,@ID='CBDD65AD-D3C5-4798-83C1-0AE9E2849096',@OriginalId='00000000-0000-0000-0000-000000000000'