public static void Init(Assembly asm)
        {
            var instance = new DataAnnotationMappingAdapter();

            Instance = instance;

#if !SDK35
            AssociationAttributeType = asm.GetType(StrAssociationAttribute);
            KeyAttributeType         = asm.GetType(StrKeyAttribute);

            instance.Association              = new AssociationAttribute();
            instance.Association.ThisKey      = AssociationAttributeType.GetProperty("ThisKey").GetGetter();
            instance.Association.OtherKey     = AssociationAttributeType.GetProperty("OtherKey").GetGetter();
            instance.Association.IsForeignKey = AssociationAttributeType.GetProperty("IsForeignKey").GetGetter();
#endif

            RequiredAttributeType     = asm.GetType(StrRequiredAttribute);
            StringLengthAttributeType = asm.GetType(StrStringLengthAttribute);

            instance.StringLength        = new StringLengthAttribute();
            instance.StringLength.Length = StringLengthAttributeType.GetProperty("MaximumLength").GetGetter();
        }
        static DbConfiguration()
        {
            ManualResetEvent mre = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem(s =>
            {
                var dlinqAsm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(p => p.GetName().Name == "System.Data.Linq");
                if (dlinqAsm != null)
                {
                    ULinq.Init(dlinqAsm);
                }
                var dataAnnotiationAsm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(p => p.GetName().Name == DataAnnotationMappingAdapter.StrAssemblyName);
                if (dataAnnotiationAsm != null)
                {
                    DataAnnotationMappingAdapter.Init(dataAnnotiationAsm);
                }
                var efDataAnnotiationAsm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(p => p.GetName().Name == EFDataAnnotiationAdapter.StrAssemblyName);
                if (efDataAnnotiationAsm != null)
                {
                    EFDataAnnotiationAdapter.Init(efDataAnnotiationAsm);
                }
                //初始化PrimitiveMapper
                Converter.IsPrimitiveType(Types.Boolean);
                //初始化Expressor
                var len      = MethodRepository.Len;
                var mappings = UWay.Skynet.Cloud.Data.Common.MethodMapping.Mappings;

                mre.Set();
            }
                                         );

            Options = new Dictionary <string, DbConfigurationInfo>(StringComparer.Ordinal);
            items   = new Dictionary <string, DbConfiguration>(StringComparer.Ordinal);


            Options["MySql.Data.MySqlClient"] = new DbConfigurationInfo
            {
                Driver              = new MySqlDriver(),
                Dialect             = new MySqlDialect(),
                FuncRegistry        = new UWay.Skynet.Cloud.Data.Dialect.Function.MySQL.MySqlFunctionRegistry(),
                DbExpressionBuilder = new MySqlExpressionBuilder(),
                SqlBuilder          = (dialect, funcRegistry) => new MySqlBuilder {
                    Dialect = dialect, FuncRegistry = funcRegistry
                },

                ScriptGenerator = () => new MySQLScriptGenerator(),
                ScriptExecutor  = () => new MySQLScriptExecutor(),
                SchemaLoader    = () => new MySqlSchemaLoader(),
            };

            Options["Oracle.ManagedDataAccess.Client"] = new DbConfigurationInfo
            {
                Driver              = new OracleODPDriver(),
                Dialect             = new OracleDialect(),
                FuncRegistry        = new UWay.Skynet.Cloud.Data.Dialect.Function.Oracle.OracleFunctionRegistry(),
                DbExpressionBuilder = new OracleExpressionBuilder(),
                SqlBuilder          = (dialect, funcRegistry) => new OracleSqlBuilder {
                    Dialect = dialect, FuncRegistry = funcRegistry
                },

                ScriptGenerator = () => new OracleScriptGenerator(),
                ScriptExecutor  = () => new OracleScriptExecutor(),
                SchemaLoader    = () => new OracleSchemaLoader(),
            };

            Options[DbProviderNames.SqlServer] = new DbConfigurationInfo
            {
                Driver              = new SqlServer2005Driver(),
                Dialect             = new MsSql2005Dialect(),
                FuncRegistry        = new UWay.Skynet.Cloud.Data.Dialect.Function.MsSql.MsSql2005FunctionRegistry(),
                DbExpressionBuilder = new MsSql2005ExpressionBuilder(),
                SqlBuilder          = (dialect, funcRegistry) => new SqlServer2005SqlBuilder {
                    Dialect = dialect, FuncRegistry = funcRegistry
                },

                ScriptGenerator = () => new SqlServerScriptGenerator(),
                ScriptExecutor  = () => new SqlServerScriptExecutor(),
                SchemaLoader    = () => new SqlServerSchemaLoader(),
            };

            //Options["System.Data.SQLite"] = new DbConfigurationInfo
            //{
            //    Driver = new SQLiteDriver(),
            //    Dialect = new SQLiteDialect(),
            //    FuncRegistry = new UWay.Skynet.Cloud.Data.Dialect.Function.SQLite.SQLiteFunctionManager(),
            //    DbExpressionBuilder = new SQLiteExpressionBuilder(),
            //    SqlBuilder = (dialect, funcRegistry) => new SQLiteSqlBuilder { Dialect = dialect, FuncRegistry = funcRegistry },

            //    ScriptGenerator = () => new SQLiteScriptGenerator(),
            //    ScriptExecutor = () => new SQLiteScriptExecutor(),
            //    SchemaLoader = () => new SQLiteSchemaLoader(),

            //};

            //Options["System.Data.SqlServerCe.3.5"] = new DbConfigurationInfo
            //{
            //    Driver = new SqlCeDriver(),
            //    Dialect = new SqlCe35Dialect(),
            //    FuncRegistry = new UWay.Skynet.Cloud.Data.Dialect.Function.SqlCe.SqlCeFunctionRegistry(),
            //    DbExpressionBuilder = new SqlCe35ExpressionBuilder(),
            //    SqlBuilder = (dialect, funcRegistry) => new SqlCeBuilder { Dialect = dialect, FuncRegistry = funcRegistry },

            //    ScriptGenerator = () => new SqlCeScriptGenerator(),
            //    ScriptExecutor = () => new SqlCeScriptExecutor(),
            //    SchemaLoader = () => new SqlCeSchemaLoader(),

            //};

            //Options["System.Data.SqlServerCe.4.0"] = new DbConfigurationInfo
            //{
            //    Driver = new SqlCeDriver(),
            //    Dialect = new SqlCe35Dialect(),
            //    FuncRegistry = new UWay.Skynet.Cloud.Data.Dialect.Function.SqlCe.SqlCeFunctionRegistry(),
            //    DbExpressionBuilder = new SqlCe35ExpressionBuilder(),
            //    SqlBuilder = (dialect, funcRegistry) => new SqlCeBuilder { Dialect = dialect, FuncRegistry = funcRegistry },

            //    ScriptGenerator = () => new SqlCeScriptGenerator(),
            //    ScriptExecutor = () => new SqlCeScriptExecutor(),
            //    SchemaLoader = () => new SqlCeSchemaLoader(),

            //};

            //providerNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
            //foreach (var item in DbProviderFactories.GetFactoryClasses().Rows.Cast<DataRow>().Select(p => p["InvariantName"] as string))
            //    providerNames.Add(item);

            mre.WaitOne();
            mre.Close();
        }