コード例 #1
0
 public IUnitOfWorkGeneric <TEntity> CreateUoW <TEntity>(IUnitOfWorkFactory unitOfWorkFactory) where TEntity : class, IDomainObject, new()
 {
     if (IsNewEntity)
     {
         if (RootUoW == null)
         {
             return(unitOfWorkFactory.CreateWithNewRoot <TEntity>());
         }
         else
         {
             return(unitOfWorkFactory.CreateWithNewChildRoot <TEntity>(RootUoW));
         }
     }
     else
     {
         if (RootUoW == null)
         {
             return(unitOfWorkFactory.CreateForRoot <TEntity>(EntityOpenId));
         }
         else
         {
             return(unitOfWorkFactory.CreateForChildRoot <TEntity>(RootUoW.GetById <TEntity>(EntityOpenId), RootUoW));
         }
     }
 }
コード例 #2
0
 public IUnitOfWorkGeneric <TEntity> CreateUoW <TEntity>(IUnitOfWorkFactory unitOfWorkFactory, string UoWTitle = null) where TEntity : class, IDomainObject, new()
 {
     if (IsNewEntity)
     {
         return(unitOfWorkFactory.CreateWithNewRoot <TEntity>(UoWTitle));
     }
     else
     {
         return(unitOfWorkFactory.CreateForRoot <TEntity>(EntityOpenId, UoWTitle));
     }
 }
コード例 #3
0
 /// <summary>
 /// Создаем Unit of Work загружая сущность по id.
 /// </summary>
 /// <returns>UnitOfWork.</returns>
 /// <typeparam name="TEntity">Тип объекта доменной модели, должен реализовывать интерфейс IDomainObject.</typeparam>
 public static IUnitOfWorkGeneric <TEntity> CreateForRoot <TEntity>(int id, string userActionTitle = null, [CallerMemberName] string callerMemberName = null, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0) where TEntity : class, IDomainObject, new()
 {
     return(unitOfWorkFactory.CreateForRoot <TEntity>(id, userActionTitle, callerMemberName, callerFilePath, callerLineNumber));
 }