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; } } }
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); }
//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); }
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); }
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); }
//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); }
//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); }
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); }
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); }
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); }