Exemple #1
0
        public void Delete(T entity)
        {
            if (entity.Id == Guid.Empty)
            {
                throw IEntityIDNotSetException.ExceptionForDeleteFail <T>();
            }

            DeleteByID(entity.Id);
        }
Exemple #2
0
        public void Add(T entity)
        {
            if (entity.Id == Guid.Empty)
            {
                throw IEntityIDNotSetException.ExceptionForInsertFail <T>();
            }

            _collection.Insert(entity);
        }
Exemple #3
0
        public void Update(T entity)
        {
            if (entity.Id == Guid.Empty)
            {
                throw IEntityIDNotSetException.ExceptionForUpdateFail <T>();
            }

            entity.UpdatedDateUtc = DateTimeOffset.UtcNow;
            _collection.Save <T>(entity);
        }