Beispiel #1
0
        public void TestEntitySourceMergerCopiesInputStruct()
        {
            IEntitySource source = new EntitySource("ns", "cnt", "id", "act");
            var           merger = new EntitySourceMerger(source);

            Assert.AreNotSame(source, merger.DefaultSource);
            Assert.AreEqual(source, merger.DefaultSource);
        }
Beispiel #2
0
        /// <summary>
        /// 实体源更新
        /// </summary>
        /// <param name="es"></param>
        /// <param name="autoSave"></param>
        /// <returns></returns>
        public async Task <EntitySource> UpdateEntitySource(EntitySource es, bool autoSave = false)
        {
            await _configRepository.Orm.Update <EntitySource>().SetSource(es).Where(x => x.Id == es.Id).ExecuteAffrowsAsync();

            if (autoSave)
            {
                UnitOfWork.Commit();
            }
            return(es);
        }
Beispiel #3
0
        /// <summary>
        /// 新增实体源
        /// </summary>
        /// <param name="entitySource"></param>
        /// <param name="autoSave"></param>
        /// <returns></returns>
        public async Task <EntitySource> AddEntitySource(EntitySource entitySource, bool autoSave = false)
        {
            var id = await _configRepository
                     .Orm
                     .Insert(entitySource)
                     .ExecuteIdentityAsync();

            entitySource.Id = id;
            if (autoSave)
            {
                UnitOfWork.Commit();
            }
            return(entitySource);
        }
Beispiel #4
0
 private void Initialize()
 {
     Suppliers = new EntitySource<Supplier>(this);
     Products = new EntitySource<Product>(this);
 }