コード例 #1
0
 public void InitConfig(IConfigurationSection section)
 {
     foreach (IConfigurationSection dbsection in section.GetChildren())
     {
         DbConnectionConfig connectionConfig = new DbConnectionConfig();
         connectionConfig.InitConfig(dbsection);
         Connections.Add(connectionConfig);
     }
 }
コード例 #2
0
        public IDatabase Build(string ConnectionName)
        {
            //this.ConnectionName = ConnectionName;
            DbConnectionConfig dbconfig = Config.Connections.FirstOrDefault(m => m.Name.ToLower() == ConnectionName.ToLower());

            if (dbconfig.IsNotNull())
            {
                var config       = new CissyDapperConfiguration(typeof(AutoClassMapper <>), new List <Assembly>(), new K());
                var sqlGenerator = new SqlGeneratorImpl(config);
                T   dbconnection = new T();
                dbconnection.ConnectionString = dbconfig.GetConnectionString();
                return(new DB(dbconnection, sqlGenerator));
            }
            return(default(IDatabase));
        }