コード例 #1
0
 internal static bool CheckExclude(
     CodeDefinition codeDefinition,
     ColumnDefinition columnDefinition)
 {
     if (codeDefinition.NotJoin && columnDefinition.JoinTableName != string.Empty)
     {
         return(true);
     }
     if (codeDefinition.Join && columnDefinition.JoinTableName == string.Empty)
     {
         return(true);
     }
     if (codeDefinition.JoinExpression && columnDefinition.JoinExpression == string.Empty)
     {
         return(true);
     }
     if (codeDefinition.Pk && columnDefinition.Pk == 0)
     {
         return(true);
     }
     if (codeDefinition.NotPk && columnDefinition.Pk != 0)
     {
         return(true);
     }
     if (codeDefinition.Session && !columnDefinition.Session)
     {
         return(true);
     }
     if (codeDefinition.Identity && !columnDefinition.Identity)
     {
         return(true);
     }
     if (codeDefinition.NotIdentity && columnDefinition.Identity)
     {
         return(true);
     }
     if (codeDefinition.Unique && !columnDefinition.Unique)
     {
         return(true);
     }
     if (codeDefinition.NotUnique && columnDefinition.Unique)
     {
         return(true);
     }
     if (codeDefinition.NotDefault && columnDefinition.Default != string.Empty)
     {
         return(true);
     }
     if (codeDefinition.ItemId &&
         Def.ExistsModel(columnDefinition.ModelName, o => o.ItemId > 0) &&
         columnDefinition.ColumnName != columnDefinition.ModelName + "Id")
     {
         return(true);
     }
     if (codeDefinition.NotItemId &&
         Def.ExistsModel(columnDefinition.ModelName, o => o.ItemId > 0) &&
         columnDefinition.ColumnName == columnDefinition.ModelName + "Id")
     {
         return(true);
     }
     if (codeDefinition.Calc && columnDefinition.Calc == string.Empty)
     {
         return(true);
     }
     if (codeDefinition.NotCalc && columnDefinition.Calc != string.Empty)
     {
         return(true);
     }
     if (codeDefinition.NotWhereSpecial && columnDefinition.WhereSpecial)
     {
         return(true);
     }
     if (codeDefinition.SearchIndex && columnDefinition.SearchIndexPriority == 0)
     {
         return(true);
     }
     if (codeDefinition.NotByForm && columnDefinition.ByForm != string.Empty)
     {
         return(true);
     }
     if (codeDefinition.Form && columnDefinition.NotForm)
     {
         return(true);
     }
     if (codeDefinition.Select && columnDefinition.NotSelect)
     {
         return(true);
     }
     if (codeDefinition.Update && columnDefinition.NotUpdate)
     {
         return(true);
     }
     if (codeDefinition.SelectColumns && columnDefinition.SelectColumns == string.Empty)
     {
         return(true);
     }
     if (codeDefinition.NotSelectColumn && columnDefinition.SelectColumns != string.Empty)
     {
         return(true);
     }
     if (codeDefinition.ComputeColumn && columnDefinition.ComputeColumn == string.Empty)
     {
         return(true);
     }
     if (codeDefinition.NotSelectColumn && columnDefinition.ComputeColumn != string.Empty)
     {
         return(true);
     }
     if (codeDefinition.Aggregatable && !columnDefinition.Aggregatable)
     {
         return(true);
     }
     if (codeDefinition.Computable && !columnDefinition.Computable)
     {
         return(true);
     }
     if (codeDefinition.Include != string.Empty && !codeDefinition.Include.Split(',').Contains(columnDefinition.ColumnName))
     {
         return(true);
     }
     if (codeDefinition.Exclude != string.Empty && codeDefinition.Exclude.Split(',').Contains(columnDefinition.ColumnName))
     {
         return(true);
     }
     if (codeDefinition.IncludeTypeName != string.Empty && !codeDefinition.IncludeTypeName.Split(',').Contains(columnDefinition.TypeName))
     {
         return(true);
     }
     if (codeDefinition.ExcludeTypeName != string.Empty && codeDefinition.ExcludeTypeName.Split(',').Contains(columnDefinition.TypeName))
     {
         return(true);
     }
     if (codeDefinition.IncludeTypeCs != string.Empty && !codeDefinition.IncludeTypeCs.Split(',').Contains(columnDefinition.TypeCs))
     {
         return(true);
     }
     if (codeDefinition.ExcludeTypeCs != string.Empty && codeDefinition.ExcludeTypeCs.Split(',').Contains(columnDefinition.TypeCs))
     {
         return(true);
     }
     if (codeDefinition.IncludeDefaultCs != string.Empty && !codeDefinition.IncludeDefaultCs.Split(',').Contains(columnDefinition.DefaultCs))
     {
         return(true);
     }
     if (codeDefinition.ExcludeDefaultCs != string.Empty && codeDefinition.ExcludeDefaultCs.Split(',').Contains(columnDefinition.DefaultCs))
     {
         return(true);
     }
     if (codeDefinition.NotTypeCs && columnDefinition.TypeCs != string.Empty)
     {
         return(true);
     }
     if (codeDefinition.History && columnDefinition.History == 0)
     {
         return(true);
     }
     if (codeDefinition.PkHistory && columnDefinition.PkHistory == 0)
     {
         return(true);
     }
     if (codeDefinition.GridColumn && columnDefinition.GridColumn == 0)
     {
         return(true);
     }
     if (codeDefinition.FilterColumn && columnDefinition.FilterColumn == 0)
     {
         return(true);
     }
     if (codeDefinition.EditorColumn && columnDefinition.EditorColumn == 0)
     {
         return(true);
     }
     if (codeDefinition.TitleColumn && columnDefinition.TitleColumn == 0)
     {
         return(true);
     }
     if (codeDefinition.UserColumn && !columnDefinition.UserColumn)
     {
         return(true);
     }
     if (codeDefinition.NotUserColumn && columnDefinition.UserColumn)
     {
         return(true);
     }
     if (codeDefinition.EnumColumn && !columnDefinition.EnumColumn)
     {
         return(true);
     }
     if (codeDefinition.Exclude.Split(',').Contains(columnDefinition.ColumnName))
     {
         return(true);
     }
     if (codeDefinition.NotItem && Def.ExistsTable(columnDefinition.TableName, o => o.ItemId > 0))
     {
         return(true);
     }
     if (codeDefinition.ItemOnly && !Def.ExistsTable(columnDefinition.TableName, o => o.ItemId > 0))
     {
         return(true);
     }
     if (codeDefinition.GenericUi && !Def.ExistsTable(columnDefinition.TableName, o => o.GenericUi))
     {
         return(true);
     }
     if (codeDefinition.UpdateMonitor && !Def.ExistsTable(columnDefinition.TableName, o => o.UpdateMonitor))
     {
         return(true);
     }
     if (codeDefinition.ControlType != string.Empty && codeDefinition.ControlType != columnDefinition.ControlType)
     {
         return(true);
     }
     if (codeDefinition.Null && !columnDefinition.Nullable)
     {
         return(true);
     }
     if (codeDefinition.NotNull && columnDefinition.Nullable)
     {
         return(true);
     }
     if (codeDefinition.Like && !columnDefinition.Like)
     {
         return(true);
     }
     if (codeDefinition.NotBase)
     {
         if (Def.ItemModelNameCollection().Contains(columnDefinition.ModelName))
         {
             if (Def.ExistsColumnBaseItem(o =>
                                          o.ColumnName == columnDefinition.ColumnName &&
                                          !o.EachModel))
             {
                 return(true);
             }
         }
         else
         {
             if (Def.ExistsColumnBase(o =>
                                      o.ColumnName == columnDefinition.ColumnName &&
                                      !o.EachModel))
             {
                 return(true);
             }
         }
     }
     if (codeDefinition.IdentityOrPk)
     {
         if ((HasUniqueColumn(columnDefinition) && !(columnDefinition.Identity || columnDefinition.Unique)) ||
             (!HasUniqueColumn(columnDefinition) && columnDefinition.Pk == 0))
         {
             return(true);
         }
     }
     return(false);
 }