コード例 #1
0
        public void CreateProfile(TEntity entity)
        {
            int userId = 0;

            using (var session = new MongoSession(_connectionString))
            {
                userId = session.GetNextSequence("user_id");
            }
            entity.UserId = userId;
            Save(entity);
        }
コード例 #2
0
        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);
        }