Esempio n. 1
0
 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();
 }
        /// <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);
        }
        /// <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);
        }
 /// <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;
 }
 /// <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;
 }
Esempio n. 6
0
 private static IConnectionFactory CreateConnectionFactory(DbProviderElement element)
 {
     return(ConnectionFactoryBuilder.NewBuilder(element.Provider, GetConnectionString(element), element.Name, element.Dialect).Build());
 }
Esempio n. 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();
 }