コード例 #1
0
        /// <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;
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        /// <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)));
        }
コード例 #4
0
 /// <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));
 }