예제 #1
0
 public DbColumnInfo(EntityMemberInfo member, DbTableInfo table, string columnName, DbTypeInfo typeInfo)
     : base(table.DbModel, table.Schema, DbObjectType.Column, member)
 {
     Member     = member;
     Table      = table;
     ColumnName = columnName;
     TypeInfo   = typeInfo;
     Table.Columns.Add(this);
     base.GlobalName = DbModelHelper.GetGlobalName(Schema, table.TableName, columnName);
     if (member.Flags.IsSet(EntityMemberFlags.Nullable))
     {
         Flags |= DbColumnFlags.Nullable;
     }
     if (member.Flags.IsSet(EntityMemberFlags.Identity))
     {
         Flags |= DbColumnFlags.Identity;
     }
     if (member.Flags.IsSet(EntityMemberFlags.ForeignKey))
     {
         Flags |= DbColumnFlags.ForeignKey;
         if (member.ForeignKeyOwner.ReferenceInfo.ToKey.Entity.Flags.IsSet(EntityFlags.HasIdentity))
         {
             Flags |= DbColumnFlags.IdentityForeignKey;
         }
     }
 }
예제 #2
0
 public void SetName(string columnName)
 {
     ColumnName          = columnName;
     ColumnNameQuoted    = Table.DbModel.Driver.SqlDialect.QuoteName(columnName);
     base.LogRefName     = DbModelHelper.JoinNames(Schema, Table.TableName, columnName);
     SqlColumnNameQuoted = new TextSqlFragment(ColumnNameQuoted);
 }
예제 #3
0
 //Creates a stub for commands loaded from the database
 public DbCommandInfo(DbModel model, string schema, string commandName, string text, string tag) :
     base(model, schema, DbObjectType.Command, null)
 {
     CommandName     = commandName;
     StoredProcText  = text;
     DescriptiveTag  = tag;
     FullCommandName = model.Driver.FormatFullName(Schema, CommandName);
     model.AddCommand(this);
     base.GlobalName = DbModelHelper.GetGlobalName(Schema, commandName);
 }
예제 #4
0
 public DbKeyInfo(string name, DbTableInfo table, KeyType type, EntityKeyInfo entityKey = null)
     : base(table.DbModel, table.Schema, DbObjectType.Key, entityKey)
 {
     Name      = name;
     Table     = table;
     KeyType   = type;
     EntityKey = entityKey;
     table.Keys.Add(this);
     base.GlobalName = DbModelHelper.GetGlobalName(table.Schema, name);
 }
예제 #5
0
 public DbRefConstraintInfo(DbModel dbModel, DbKeyInfo fromKey, DbKeyInfo toKey, bool cascadeDelete, EntityReferenceInfo ownerRef = null)
     : base(dbModel, fromKey.Schema, DbObjectType.RefConstraint, ownerRef)
 {
     Util.Check(fromKey != null, "fromKey may not be null.");
     Util.Check(toKey != null, "toKey may not be null.");
     FromKey         = fromKey;
     ToKey           = toKey;
     OwnerReference  = ownerRef;
     CascadeDelete   = cascadeDelete;
     base.GlobalName = DbModelHelper.GetGlobalName(fromKey.Table.Schema, fromKey.Name);
 }
예제 #6
0
 //constructor loader from the database
 public DbColumnInfo(DbTableInfo table, string columnName, DbTypeInfo typeInfo)
     : base(table.DbModel, table.Schema, DbObjectType.Column, null)
 {
     Table      = table;
     ColumnName = columnName;
     TypeInfo   = typeInfo;
     if (typeInfo.IsNullable)
     {
         this.Flags |= DbColumnFlags.Nullable;
     }
     Table.Columns.Add(this);
     base.GlobalName = DbModelHelper.GetGlobalName(table.Schema, table.TableName, columnName);
 }
예제 #7
0
 //constructor loader from the database
 public DbColumnInfo(DbTableInfo table, string columnName, DbTypeInfo typeInfo, bool isNullable)
     : base(table.DbModel, table.Schema, DbObjectType.Column, null)
 {
     Table = table;
     SetName(columnName);
     // TO FIX
     TypeInfo = typeInfo;
     if (isNullable)
     {
         this.Flags |= DbColumnFlags.Nullable;
     }
     Table.Columns.Add(this);
     base.LogRefName = DbModelHelper.JoinNames(table.Schema, table.TableName, columnName);
 }
예제 #8
0
 public DbTableInfo(DbModel model, string schema, string tableName, EntityInfo entity, DbObjectType objectType = DbObjectType.Table)
     : base(model, schema, objectType, entity)
 {
     TableName = tableName;
     Entity    = entity; //might be null
     Kind      = EntityKind.Table;
     if (Entity != null)
     {
         Kind = Entity.Kind;
     }
     else if (objectType == DbObjectType.View)
     {
         Kind = EntityKind.View; // when loading from database
     }
     FullName        = model.Driver.FormatFullName(Schema, tableName);
     base.GlobalName = DbModelHelper.GetGlobalName(Schema, TableName);
     model.AddTable(this);
 }
예제 #9
0
        public DbCommandInfo(EntityCommand entityCommand, string commandName, DbTableInfo table, DbExecutionType executionType, string sql, string tag)
            : base(table.DbModel, table.Schema, DbObjectType.Command, entityCommand)
        {
            EntityCommand  = entityCommand;
            CommandName    = commandName;
            Table          = table;
            ExecutionType  = executionType;
            Sql            = sql;
            Description    = EntityCommand.Description;
            DescriptiveTag = tag;
            //derived entities
            FullCommandName = Table.DbModel.Driver.FormatFullName(Schema, CommandName);
            Kind            = entityCommand.Kind;
            var dbModel = table.DbModel;

            dbModel.AddCommand(this);
            if (Table != null)
            {
                Table.CrudCommands.Add(this);
            }
            base.GlobalName = DbModelHelper.GetGlobalName(Schema, commandName);
        }
예제 #10
0
 public DbTableInfo(DbModel model, string schema, string tableName, EntityInfo entity, DbObjectType objectType = DbObjectType.Table)
     : base(model, schema, objectType, entity)
 {
     TableName = tableName;
     Entity    = entity; //might be null
     Kind      = EntityKind.Table;
     if (Entity != null)
     {
         Kind = Entity.Kind;
     }
     else if (objectType == DbObjectType.View)
     {
         Kind = EntityKind.View; // when loading from database
     }
     FullName        = model.FormatFullName(Schema, tableName);
     base.LogRefName = DbModelHelper.JoinNames(Schema, TableName);
     if (!IsNullTable())
     {
         model.AddTable(this);
     }
     DefaultSqlAlias = DbModelHelper.GetDefaultSqlAlias(this.TableName);
 }