Exemplo n.º 1
0
        IList <EntityDTO> IDeleteInfo.GetDependEntities(IDeleteCore core, ClearDependenceInfo depend, EntityDTO masterEntity)
        {
            var list = core.UoW.Session.CreateCriteria(ObjectClass)
                       .Add(Restrictions.Eq(depend.PropertyName + ".Id", (int)masterEntity.Id)).List();

            return(MakeResultList(list));
        }
Exemplo n.º 2
0
 public Operation CreateClearOperation(EntityDTO masterEntity, ClearDependenceInfo depend, IList <EntityDTO> dependEntities)
 {
     return(new SQLCleanOperation()
     {
         ItemId = masterEntity.Id,
         TableName = TableName,
         CleanField = depend.ClearField,
         WhereStatment = depend.WhereStatment
     });
 }
Exemplo n.º 3
0
 public Operation CreateClearOperation(EntityDTO masterEntity, ClearDependenceInfo depend, IList <EntityDTO> dependEntities)
 {
     return(new HibernateCleanOperation {
         ItemId = masterEntity.Id,
         CleaningEntity = masterEntity,
         ClearingItems = dependEntities,
         EntityType = depend.ObjectClass,
         PropertyName = depend.PropertyName
     });
 }
Exemplo n.º 4
0
 internal IDeleteInfo GetDeleteInfo(ClearDependenceInfo clearDependence)
 {
     if (clearDependence.ObjectClass != null)
     {
         return(ClassInfos.Find(i => i.ObjectClass == clearDependence.ObjectClass));
     }
     else
     {
         return(ClassInfos.OfType <DeleteInfo>().First(i => i.TableName == clearDependence.TableName));
     }
 }
Exemplo n.º 5
0
        public void AddClearDependence <ToClass> (ClearDependenceInfo clearDependence)
        {
            var info = ClassInfos.Find(i => i.ObjectClass == typeof(ToClass));

            if (info == null)
            {
                throw new InvalidOperationException(String.Format("Описание удаления для класса {0} не найдено.", typeof(ToClass)));
            }

            info.ClearItems.Add(clearDependence);
        }
Exemplo n.º 6
0
 IList <EntityDTO> IDeleteInfo.GetDependEntities(IDeleteCore core, ClearDependenceInfo depend, EntityDTO masterEntity)
 {
     return(GetEntitiesList(core.UoW.Session.Connection, depend.WhereStatment, masterEntity.Id));
 }
Exemplo n.º 7
0
 public DeleteInfoHibernate <TEntity> AddClearDependence <TDependOn>(Expression <Func <TDependOn, object> > propertyRefExpr)
 {
     ClearItems.Add(ClearDependenceInfo.Create <TDependOn> (propertyRefExpr));
     return(this);
 }