/// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        public static ICreateTableWithColumnSyntax TableForEntity <TEntity>(this ICreateExpressionRoot root)
            where TEntity : class, IEntity
        {
            var tableName = TableName.ForEntity <TEntity>();

            return(root.Table(tableName));
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
 public static ICreateTableColumnOptionOrWithColumnSyntax TableForModel(this ICreateExpressionRoot expressionRoot, string name)
 {
     return(expressionRoot.Table(name).WithColumn("Id").AsInt32().PrimaryKey().Identity());
 }
예제 #6
0
 /// <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>()));
 }
예제 #7
0
        public static ICreateTableWithColumnOrSchemaOrDescriptionSyntax Table(this ICreateExpressionRoot create, Tables table)
        {
            var tableName = Enum.GetName(typeof(Tables), table);

            return(create.Table(tableName));
        }
예제 #8
0
 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());
 }
예제 #10
0
 public static ICreateTableWithColumnOrSchemaSyntax Table <T>(this ICreateExpressionRoot root)
 {
     return(root.Table(typeof(T).Name));
 }