/// <summary> /// Retrieves expressions into ICreateExpressionRoot /// </summary> /// <param name="expressionRoot">The root expression for a CREATE operation</param> /// <typeparam name="TEntity">Entity type</typeparam> public static void TableFor <TEntity>(this ICreateExpressionRoot expressionRoot) where TEntity : BaseEntity { var type = typeof(TEntity); var builder = expressionRoot.Table(NameCompatibilityManager.GetTableName(type)) as CreateTableExpressionBuilder; builder.RetrieveTableExpressions(type); }
/// <summary> /// Creates a table in Schema {<paramref name="migration"/>.SchemaName}<br/> /// If {migration.SchemaPrefix} have a value, the Syntax-TableName will be computed to {<paramref name="migration"/>.SchemaPrefix}{<paramref name="tableName"/>}<br/> /// If NOT, the Syntax-TableName will be the same as {<paramref name="tableName"/>} /// </summary> /// <param name="root">Expression root to extend</param> /// <param name="tableName"> /// The table name<br/> /// See summary-section how this parameter is used /// </param> /// <param name="migration"></param> /// <returns></returns> public static ICreateTableWithColumnOrSchemaOrDescriptionSyntax Table(this ICreateExpressionRoot root, string tableName, IMigrationModel migration) { var syntax = root.Table(migration.GetPrefixedName(tableName)); syntax.InSchema(migration.SchemaName); return(syntax); }
public static ICreateTableWithColumnSyntax TableForEntity <TEntity>(this ICreateExpressionRoot root) where TEntity : class, IEntity { var tableName = TableName.ForEntity <TEntity>(); return(root.Table(tableName)); }
/// <summary> /// Retrieves expressions into ICreateExpressionRoot /// </summary> /// <param name="expressionRoot">The root expression for a CREATE operation</param> /// <typeparam name="TEntity">Entity type</typeparam> public virtual void BuildTable <TEntity>(ICreateExpressionRoot expressionRoot) { var type = typeof(TEntity); var builder = expressionRoot.Table(NameCompatibilityManager.GetTableName(type)) as CreateTableExpressionBuilder; RetrieveTableExpressions(type, builder); }
public static ICreateTableColumnOptionOrWithColumnSyntax TableForModel(this ICreateExpressionRoot expressionRoot, string name) { return(expressionRoot.Table(name).WithColumn("Id").AsInt32().PrimaryKey().Identity()); }
/// <summary> /// Создает таблицу с именем на основе типа <typeparamref name="TTable"/>. /// </summary> /// <returns>См. <see cref="ICreateExpressionRoot.Table(string)"/>.</returns> /// <remarks>В качестве имени таблицы используется значение атрибута <see cref="TableAttribute"/> или имя типа в единственном числе.</remarks> public static ICreateTableWithColumnOrSchemaOrDescriptionSyntax Table <TTable>(this ICreateExpressionRoot create) { return(create.Table(GetTableName <TTable>())); }
public static ICreateTableWithColumnOrSchemaOrDescriptionSyntax Table(this ICreateExpressionRoot create, Tables table) { var tableName = Enum.GetName(typeof(Tables), table); return(create.Table(tableName)); }
public static ICreateTableWithColumnSyntax AppTable(this ICreateExpressionRoot createExpressionRoot, string tableName) { return(createExpressionRoot.Table(tableName).InSchema(SchemaExtensions.Name)); }
public static ICreateTableWithColumnSyntax DictionaryTable(this ICreateExpressionRoot createExpressionRoot, string tableName) { return(createExpressionRoot.Table(tableName) .WithColumn("Id").AsInt32().PrimaryKey().Identity().NotNullable() .WithColumn("Name").AsString(2000).Unique("IX_" + tableName + "_Name").NotNullable()); }
public static ICreateTableWithColumnOrSchemaSyntax Table <T>(this ICreateExpressionRoot root) { return(root.Table(typeof(T).Name)); }