Upsert in Disconnected Scenarios

12 views
Skip to first unread message

krishnamur...@gmail.com

unread,
May 17, 2016, 10:42:42 AM5/17/16
to Siaqodb - NoSQL embedded database for .NET
Hello

I need to Insert or Update in a disconnected scenario. The entity is read at a certain point in time but it is passed back to a function at a later time. This function needs to Insert if the entity is new but update if it already exists. I am looking for a functionality similar to AddorUpdate in Entity Framework.

Any suggestions?


Cheers

Suresh

Siaqodb Support

unread,
May 17, 2016, 11:59:47 AM5/17/16
to Siaqodb - NoSQL embedded database for .NET, krishnamur...@gmail.com
That is possible by design using OID property. The only thing you have to do is to add an automatic property to your entity called OID. When you call 

siaqodb.StoreObject(yourEntity);

Siaqodb will automatically check if object exists and it will update or insert if the object is new.

example of such entity:
public class MyEntity
{
   
public int OID {get;set;}
}

Cristi
Reply all
Reply to author
Forward
0 new messages