コード例 #1
0
ファイル: Program.cs プロジェクト: zyj0021/EasyDb.NET
 static Program()
 {
     factory = ConnectionFactoryBuilder.NewBuilder("mysql.data",
                                                   "Server=127.0.0.1;Uid=root;Pwd=asdf;Database=sample;", null,
                                                   "LX.EasyDb.Dialects.MySQLDialect").Build();
     //factory = ConnectionFactoryBuilder.NewBuilder(System.Data.SQLite.SQLiteFactory.Instance,
     //    "Data Source=test.db;Pooling=true;FailIfMissing=false", null,
     //    new SQLiteDialect()).Build();
 }
コード例 #2
0
        /// <summary>
        /// Gets a builder.
        /// </summary>
        /// <param name="provider">the provider that implements the data source classes</param>
        /// <param name="connectionString">the connection used to open the database</param>
        /// <param name="name">the name of the provider</param>
        /// <param name="dialect">the SQL dialect to apply</param>
        /// <returns><see cref="LX.EasyDb.ConnectionFactoryBuilder"/></returns>
        public static ConnectionFactoryBuilder NewBuilder(String provider, String connectionString, String name, String dialect)
        {
            ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();

            builder._factory          = GetProvider(provider);
            builder._connectionString = connectionString;
            builder._name             = name;
            builder._dialect          = Dialect.CreateDialect(dialect);
            return(builder);
        }
コード例 #3
0
        /// <summary>
        /// Gets a builder.
        /// </summary>
        /// <param name="factory">the <see cref="System.Data.Common.DbProviderFactory"/> that creating instances of a provider's implementation of the data source classes</param>
        /// <param name="connectionString">the connection used to open the database</param>
        /// <param name="name">the name of the provider</param>
        /// <param name="dialect">the SQL dialect to apply</param>
        /// <returns><see cref="LX.EasyDb.ConnectionFactoryBuilder"/></returns>
        public static ConnectionFactoryBuilder NewBuilder(System.Data.Common.DbProviderFactory factory, String connectionString, String name, Dialect dialect)
        {
            ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();

            builder._factory          = factory;
            builder._connectionString = connectionString;
            builder._name             = name;
            builder._dialect          = dialect;
            return(builder);
        }
コード例 #4
0
 /// <summary>
 /// Gets a builder.
 /// </summary>
 /// <param name="provider">the provider that implements the data source classes</param>
 /// <param name="connectionString">the connection used to open the database</param>
 /// <param name="name">the name of the provider</param>
 /// <param name="dialect">the SQL dialect to apply</param>
 /// <returns><see cref="LX.EasyDb.ConnectionFactoryBuilder"/></returns>
 public static ConnectionFactoryBuilder NewBuilder(String provider, String connectionString, String name, String dialect)
 {
     ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();
     builder._factory = GetProvider(provider);
     builder._connectionString = connectionString;
     builder._name = name;
     builder._dialect = Dialect.CreateDialect(dialect);
     return builder;
 }
コード例 #5
0
 /// <summary>
 /// Gets a builder.
 /// </summary>
 /// <param name="factory">the <see cref="System.Data.Common.DbProviderFactory"/> that creating instances of a provider's implementation of the data source classes</param>
 /// <param name="connectionString">the connection used to open the database</param>
 /// <param name="name">the name of the provider</param>
 /// <param name="dialect">the SQL dialect to apply</param>
 /// <returns><see cref="LX.EasyDb.ConnectionFactoryBuilder"/></returns>
 public static ConnectionFactoryBuilder NewBuilder(System.Data.Common.DbProviderFactory factory, String connectionString, String name, Dialect dialect)
 {
     ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();
     builder._factory = factory;
     builder._connectionString = connectionString;
     builder._name = name;
     builder._dialect = dialect;
     return builder;
 }
コード例 #6
0
 private static IConnectionFactory CreateConnectionFactory(DbProviderElement element)
 {
     return(ConnectionFactoryBuilder.NewBuilder(element.Provider, GetConnectionString(element), element.Name, element.Dialect).Build());
 }
コード例 #7
0
 /// <summary>
 /// Initializes EasyDbHelper.
 /// </summary>
 /// <param name="provider">the provider that implements the data source classes</param>
 /// <param name="connectionString">the string used to open a database</param>
 /// <param name="dialect">the SQL dialect to apply</param>
 public static void Initialize(String provider, String connectionString, String dialect)
 {
     ConnectionFactory = ConnectionFactoryBuilder.NewBuilder(provider, connectionString, "EasyDbHelper", dialect).Build();
 }