public void AddOrUpdate(T entity) { // if there is no ID, then assume this is a "new" person // and assign an ID if (string.IsNullOrEmpty(entity.Id)) { entity.Id = Guid.NewGuid().ToString(); // string.Format("{0}::{1}", entity.Type, Guid.NewGuid()); } _context.Save(entity); // alternate: with plain .NET SDK // var doc = new Document<Person> // { // Id = "Person::" + person.Id, // Content = person // }; // _bucket.Upsert(doc); }
public void Save(Person person) { // if there is no ID, then assume this is a "new" person // and assign an ID if (string.IsNullOrEmpty(person.Id)) { person.Id = "Person::" + Guid.NewGuid(); } _context.Save(person); // alternate: with plain .NET SDK // var doc = new Document<Person> // { // Id = "Person::" + person.Id, // Content = person // }; // _bucket.Upsert(doc); }
public void Insert(Airline airline) { _bucketContext.Save(airline); }