Ejemplo n.º 1
0
 AddSuffixTableConvention(this SqlFuConfig cfg, Func <Type, bool> match = null, string schema = null, string suffix = "Row")
 {
     suffix.MustNotBeNull();
     match = match ?? (t => t.Name.EndsWith(suffix));
     cfg.AddNamingConvention(match, t =>
                             new TableName(t.Name.SubstringUntil(suffix), schema));
 }
Ejemplo n.º 2
0
 public static void UseLogManager(this SqlFuConfig config)
 {
     config.OnCommand   = cmd => "SqlFu".LogDebug(cmd.FormatCommand());
     config.OnException = (cmd, ex) =>
     {
         "SqlFu".LogError("Command threw exception {0}", cmd.FormatCommand());
         "SqlFu".LogError(ex);
     };
 }
Ejemplo n.º 3
0
 internal void Assign(DbAccessProfile profile, SqlFuConfig config)
 {
     _provider         = profile.Provider;
     _connectionString = profile.ConnectionString;
     Configuration     = config;
 }
Ejemplo n.º 4
0
 public DbFactory(DbAccessProfile profile, SqlFuConfig config)
 {
     Assign(profile, config);
 }
Ejemplo n.º 5
0
 public static void ResetConfig()
 {
     config = new SqlFuConfig();
 }
Ejemplo n.º 6
0
 public static IDbFactory CreateFactoryForTesting(this SqlFuConfig cfg, IDbProvider prov, string cnx)
 => new DbFactoryForTests(prov, cnx, cfg);
Ejemplo n.º 7
0
 public DbFactoryForTests(IDbProvider provider, string cnx, SqlFuConfig config)
 {
     _cnx     = cnx;
     _config  = config;
     Provider = provider;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// How SqlFu will handle value of type when writing/reading to/from db
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static IRegisterTypeConverter <T> WhenType <T>(this SqlFuConfig cfg) => new ConverterRegister <T>(Config.Converters);