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)); }
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); }; }
internal void Assign(DbAccessProfile profile, SqlFuConfig config) { _provider = profile.Provider; _connectionString = profile.ConnectionString; Configuration = config; }
public DbFactory(DbAccessProfile profile, SqlFuConfig config) { Assign(profile, config); }
public static void ResetConfig() { config = new SqlFuConfig(); }
public static IDbFactory CreateFactoryForTesting(this SqlFuConfig cfg, IDbProvider prov, string cnx) => new DbFactoryForTests(prov, cnx, cfg);
public DbFactoryForTests(IDbProvider provider, string cnx, SqlFuConfig config) { _cnx = cnx; _config = config; Provider = provider; }
/// <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);