public bool MigratesFor(DatabaseKind databaseKind)
 {
     Attribute[] attrs = Attribute.GetCustomAttributes(MigrationType);
     if (attrs.Length == 0) return true;
     var onlyWhen = (OnlyForAttribute)attrs[0];
     return onlyWhen.DatabaseKinds.Contains(databaseKind);
 }
 /// <summary>
 /// Create new instance of the database test
 /// </summary>
 /// <param name="script"></param>
 /// <param name="databaseTestType"></param>
 /// <param name="databaseKind"></param>
 public Test(string script, TestType databaseTestType, DatabaseKind databaseKind)
 {
     Variable         = null;
     Script           = script;
     DatabaseTestType = databaseTestType;
     DatabaseKind     = databaseKind;
 }
 /// <summary>
 /// Create new instance of MySQL script generator
 /// </summary>
 /// <param name="databaseKind"></param>
 /// <param name="options"></param>
 public RelationalDatabaseTestGenerator(DatabaseKind databaseKind,
                                        Action <TestGeneratorOptions> options = null)
 {
     DatabaseTestOptions = new TestGeneratorOptions();
     options?.Invoke(DatabaseTestOptions);
     DatabaseKind = databaseKind;
 }
Ejemplo n.º 4
0
 public Runner(IDataClient dataClient, Assembly targetAssembly, IVersionRepository versionRepository)
 {
     _dataClient = dataClient;
     _databaseKind = _dataClient.Database.Provider.DatabaseKind;
     _targetAssembly = targetAssembly ?? Assembly.GetCallingAssembly();
     VersionRepository = versionRepository;
     _migrationFactory = new MigrationFactory(_dataClient);
     _initialVersion = -1;
 }
Ejemplo n.º 5
0
 public Runner(IDataClient dataClient, Assembly targetAssembly, IVersionRepository versionRepository)
 {
     _dataClient       = dataClient;
     _databaseKind     = _dataClient.Database.Provider.DatabaseKind;
     _targetAssembly   = targetAssembly ?? Assembly.GetCallingAssembly();
     VersionRepository = versionRepository;
     _migrationFactory = new MigrationFactory(_dataClient);
     _initialVersion   = -1;
 }
Ejemplo n.º 6
0
        public bool MigratesFor(DatabaseKind databaseKind)
        {
            Attribute[] attrs = Attribute.GetCustomAttributes(MigrationType);
            if (attrs.Length == 0)
            {
                return(true);
            }
            var onlyWhen = (OnlyForAttribute)attrs[0];

            return(onlyWhen.DatabaseKinds.Contains(databaseKind));
        }
Ejemplo n.º 7
0
        public DBContextBuilder(string storeId, DatabaseKind kind, string id = "", bool lazyLoadingEnabled = false)
        {
            _storeId = storeId;
            _id      = id;
            _kind    = (int)kind;
            var info = GetConInfo(storeId, ((int)kind).ToString());

            _connection         = info.Connection;
            _schema             = info.Schema;
            _factory            = DbProviderFactories.GetFactory(info.ProviderName);
            _lazyLoadingEnabled = lazyLoadingEnabled;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Create new instance of database script result object - extended
 /// </summary>
 /// <param name="databaseResult"></param>
 /// <param name="variable"></param>
 /// <param name="script"></param>
 /// <param name="databaseTestType"></param>
 /// <param name="databaseKind"></param>
 /// <param name="serverCpuTime"></param>
 /// <param name="serverElapsedTime"></param>
 /// <param name="totalElapsedTime"></param>
 /// <param name="statistics"></param>
 public TestResult(bool?databaseResult, string variable, string script, TestType databaseTestType,
                   DatabaseKind databaseKind, long serverCpuTime, long serverElapsedTime, long totalElapsedTime,
                   Dictionary <string, Dictionary <string, long> > statistics)
 {
     DatabaseResult    = databaseResult;
     Variable          = variable;
     Script            = script;
     DatabaseTestType  = databaseTestType;
     DatabaseKind      = databaseKind;
     ServerCpuTime     = serverCpuTime;
     ServerElapsedTime = serverElapsedTime;
     TotalElapsedTime  = totalElapsedTime;
     Statistics        = statistics;
 }
Ejemplo n.º 9
0
        public bool MigratesFor(DatabaseKind databaseKind)
        {
            var onlyWhen = MigrationType.GetTypeInfo().GetCustomAttribute <OnlyForAttribute>();

            return(onlyWhen == null || onlyWhen.DatabaseKinds.Contains(databaseKind));
        }