EnsureTableName() public method

public EnsureTableName ( TableInfo info ) : void
info SqlFu.Configuration.Internals.TableInfo
return void
Esempio n. 1
0
        public static IBuildUpdateTable <T> Update <T>(this DbConnection db, Action <IHelperOptions> cfg = null)
        {
            var opt = new HelperOptions();

            cfg?.Invoke(opt);
            var executor = new CustomSqlExecutor(db);

            opt.EnsureTableName(db.GetPocoInfo <T>());
            return(new UpdateTableBuilder <T>(executor, db.GetExpressionSqlGenerator(), db.Provider(), opt));
        }
Esempio n. 2
0
 public UpdateBuilderTests(ITestOutputHelper x)
 {
     _writer = Setup.FakeWriter();
     _sb = new StringBuilder();
   
     _executor = new FakeSqlExecutor();
     _options = new HelperOptions();
     _options.EnsureTableName(Setup.GetTableInfo<Post>());
     _sut = new UpdateTableBuilder<Post>(_executor, _writer, new FakeEscapeIdentifier(), _options);
 }
Esempio n. 3
0
        /// <summary>
        /// Perform update table with data from an anonymous object
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="db"></param>
        /// <param name="columns">Select which columns to update from an anonymous object</param>
        /// <param name="cfg">Configure name and other</param>
        /// <returns></returns>
        public static IBuildUpdateTableFrom <T> UpdateFrom <T>(this DbConnection db, Func <IUpdateColumns, IColumnsToUpdate <T> > columns, Action <IHelperOptions> cfg) where  T : class
        {
            var options = new HelperOptions();
            var u       = new UpdateColumns();

            cfg(options);
            options.EnsureTableName(db.GetPocoInfo <T>());
            var builder  = columns(u) as UpdateColumns.CreateBuilder <T>;
            var executor = new CustomSqlExecutor(db);
            var updater  = new UpdateTableBuilder <T>(executor, db.GetExpressionSqlGenerator(), db.Provider(), options);

            builder.PopulateBuilder(updater);
            return(updater);
        }