public void CreateProfile(TEntity entity) { int userId = 0; using (var session = new MongoSession(_connectionString)) { userId = session.GetNextSequence("user_id"); } entity.UserId = userId; Save(entity); }
public virtual void Save(TDomain entity) { var collection = GetDefaultCollection(); if (entity.UserId == 0) { int userId = 0; var session = new MongoSession(_connectionString); userId = session.GetNextSequence("user_id"); entity.UserId = userId; } collection.Save(entity); }