Exemplo n.º 1
0
 public void AddProfile(IDbProvider provider, string connectionString, string name = "default")
 {
     provider.MustNotBeNull();
     _profiles[name] = new DbAccessProfile()
     {
         ConnectionString = connectionString, Name = name, Provider = provider
     };
 }
Exemplo n.º 2
0
        private DbAccessProfile CreateProfile <T>(IDbProvider provider, string connectionString) where T : IDbFactory
        {
            provider.MustNotBeNull();
            var type = typeof(T);

            type.GetTypeInfo().IsInterface.MustBe(true);
            var name    = type.Name;
            var profile = new DbAccessProfile()
            {
                ConnectionString = connectionString, Name = name, Provider = provider, Factory = CreateFactory <T>()
            };

            profile.Factory.CastAs <DbFactory>().Assign(profile);
            return(profile);
        }
Exemplo n.º 3
0
 internal void Assign(DbAccessProfile profile)
 {
     _provider         = profile.Provider;
     _connectionString = profile.ConnectionString;
 }
Exemplo n.º 4
0
 public DbFactory(DbAccessProfile profile)
 {
     Assign(profile);
 }
Exemplo n.º 5
0
 internal void Assign(DbAccessProfile profile, SqlFuConfig config)
 {
     _provider         = profile.Provider;
     _connectionString = profile.ConnectionString;
     Configuration     = config;
 }
Exemplo n.º 6
0
 public DbFactory(DbAccessProfile profile, SqlFuConfig config)
 {
     Assign(profile, config);
 }