Example #1
0
        public ICreateTableQueryProvider CreateTable(Type type, bool autoDetectColumns)
        {
            checkLastQueryProvider();
            var query = new CreateTableQueryProvider(Database, MigratorSqlSyntaxProvider, TableMigratorInfo.FromPoco(type));

            lastQueryProvider = query;
            if (autoDetectColumns)
            {
                var members = type.GetPropertiesAndFields();
                foreach (var member in members)
                {
                    var column = ColumnMigratorInfo.FromMemberInfo(member);
                    if (column != null)
                    {
                        query.AddColumn(column);
                    }
                }
            }
            return(query);
        }
Example #2
0
        public static IAlterTableColumnQueryProvider AddColumn <T>(this IAlterTableQueryProvider provider, Expression <Func <T, object> > expression)
        {
            var member = expression.GetMember();

            return(provider.AddColumn(ColumnMigratorInfo.FromMemberInfo(member)));
        }