/// <summary> /// Initializes a new instance of the <see cref="TableSchemaFactory"/> class. /// </summary> public TableSchemaFactory( ITableNameFactory tableNameFactory, IColumnNameFactory columnNameFactory) { Ensure.NotNull(tableNameFactory, nameof(tableNameFactory)); Ensure.NotNull(columnNameFactory, nameof(columnNameFactory)); this.tableNameFactory = tableNameFactory; this.columnNameFactory = columnNameFactory; }
public static TableSchema MakeSchema <TEntity>(this IDialect dialect, ITableNameFactory tableNameFactory = null) { var factory = new TableSchemaFactory(tableNameFactory ?? new DefaultTableNameFactory(), new DefaultColumnNameFactory()); return(factory.MakeTableSchema(typeof(TEntity), dialect)); }
/// <summary> /// Sets the method used to get the column name from a property. /// </summary> public static void SetTableNameFactory(ITableNameFactory factory) { Ensure.NotNull(factory, nameof(factory)); SetCurrent(c => c.WithSchemaFactory(c.SchemaFactory.WithTableNameFactory(factory))); }
/// <summary> /// Creates a new <see cref="TableSchemaFactory"/> which generates table names with the <paramref name="factory"/>. /// </summary> public TableSchemaFactory WithTableNameFactory(ITableNameFactory factory) { return(new TableSchemaFactory(factory, this.columnNameFactory)); }