Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Engine"/> class.
 /// </summary>
 public Engine()
 {
     Migrations         = new Dictionary <long, Type>();
     SqlProviderFactory = new SqlProviderFactory();
     HistoryRepository  = new MigrationHistoryRepository();
     SqlProcessor       = new DatabaseSqlProcessor();
 }
Esempio n. 2
0
        public void SetSqlProviderFactoryTest()
        {
            SqlProviderFactory pf = new SqlProviderFactory();

            Target.SetSqlProviderFactory(pf);
            Assert.AreEqual(pf, Target.SqlProviderFactory);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates a new migration context.
 /// </summary>
 /// <returns>The context.</returns>
 protected virtual MigrationContext CreateContext()
 {
     return(new MigrationContext()
     {
         ConnetionString = ConnectionString,
         ProviderInvariantName = ProviderInvariantName,
         Connection = OpenConnection(),
         SqlProvider = SqlProviderFactory.GetProvider(ProviderInvariantName),
         SqlProcessor = SqlProcessor
     });
 }
Esempio n. 4
0
 /// <summary>
 /// Sets the SQL provider factory.
 /// </summary>
 /// <param name="factory">The SQL provider factory.</param>
 /// <returns>The engine.</returns>
 public virtual Engine SetSqlProviderFactory(SqlProviderFactory factory)
 {
     SqlProviderFactory = factory;
     return(this);
 }
Esempio n. 5
0
 /// <summary>
 /// Registers the provider of the specified <see cref="Type"/> at
 /// the current <see cref="ProviderFactory"/>.
 /// </summary>
 /// <param name="providerType">Type of the provider.</param>
 /// <returns>The engine.</returns>
 public virtual Engine RegisterProvider(Type providerType)
 {
     SqlProviderFactory.RegisterProvider(providerType);
     return(this);
 }
Esempio n. 6
0
 /// <summary>
 /// Scans the specified <paramref name="assembly"/> for migrations and SQL providers.
 /// </summary>
 /// <param name="assembly">The assembly to add.</param>
 /// <returns>The engine.</returns>
 public virtual Engine AddAssembly(Assembly assembly)
 {
     FindMigrations(assembly);
     SqlProviderFactory.RegisterProviders(assembly);
     return(this);
 }