public static IWrappedCommand CreateInsertAndGetID <T>(this ISqlCommandCreator creator, string tableName, T value, QueryOptions queryOptions, params string[] ignoreFields)
        {
            var    c        = (DbContext)creator;
            var    settings = FieldSettings.FromType <T>(FromTypeOption.Default);
            var    fields   = settings.Select(x => x.Name).Except(ignoreFields.Select(x => x)).ToArray();
            string query    = ((SqlCommandTextGenerator)c.ContextProvider.CommandTextGenerator).InsertAndGetID(tableName, fields);

            return(c.CreateMapped(query, fields, settings, value, queryOptions));
        }
Example #2
0
 public static string CreateTableScript <T>(string tableName, bool checkIfNotExists = false,
                                            ColumnDefinitionOptions options         = null, FromTypeOption fromTypeOption = FromTypeOption.Default)
 {
     return(FieldSettings.FromType <T>(fromTypeOption).GetColumnDefinitions(options).CreateTableScript(tableName, checkIfNotExists));
 }