public MenuControllerService(IDatabaseRepository databaseRepository, ILogger logger)
 {
     if (databaseRepository == null) throw new ArgumentNullException(nameof(databaseRepository));
     _databaseRepository = databaseRepository;
     _logger = logger;
     _fixture = new Fixture();
 }
 public AccountControllerService(IDatabaseRepository databaseRepository, IUserService userService, IConfigurationService configurationService)
 {
     if (databaseRepository == null) throw new ArgumentNullException(nameof(databaseRepository));
     if (userService == null) throw new ArgumentNullException(nameof(userService));
     if (configurationService == null) throw new ArgumentNullException(nameof(configurationService));
     _databaseRepository = databaseRepository;
     _userService = userService;
     _configurationService = configurationService;
 }
Example #3
0
        public DatabaseService(IDatabaseRepository databaseRepository)
        {
            if (databaseRepository == null)
            {
                throw new ArgumentNullException("databaseRepository");
            }

            this.repository = databaseRepository;
        }
        public UploadControllerService(IConfigurationService configurationService, IDatabaseRepository databaseRepository)
        {
            _configurationService = configurationService;
            _databaseRepository = databaseRepository;
            if (configurationService == null) throw new ArgumentNullException(nameof(configurationService));
            if (databaseRepository == null) throw new ArgumentNullException(nameof(databaseRepository));

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(configurationService.AzureStorage.ConnectionString);
            _blobClient = storageAccount.CreateCloudBlobClient();
        }
Example #5
0
 public VendorOrderMailJob(IEmailService emailService, ICacheService cacheService, IDatabaseRepository databaseRepository, IConfigurationService configurationService, ILogger logger)
 {
     if (emailService == null) throw new ArgumentNullException(nameof(emailService));
     if (cacheService == null) throw new ArgumentNullException(nameof(cacheService));
     if (configurationService == null) throw new ArgumentNullException(nameof(configurationService));
     if (logger == null) throw new ArgumentNullException(nameof(logger));
     _emailService = emailService;
     _cacheService = cacheService;
     _databaseRepository = databaseRepository;
     _configurationService = configurationService;
     _logger = logger;
 }
        public void Setup()
        {
            var container = IoC.GetInstance();
            _databaseRepository = container.GetInstance<IDatabaseRepository>();

            _story = new Story
            {
                Title = "Integration test story",
                Content = "Content of the story",
                ColumnId = 1,
                ColorValue = ""
            };
        }
 public OrderControllerService(IConfigurationService configurationService, IDatabaseRepository databaseRepository, IMapper mapper, IEventingService eventingService, IEmailService emailService, ICacheService cacheService)
 {
     if (databaseRepository == null) throw new ArgumentNullException(nameof(databaseRepository));
     if (mapper == null) throw new ArgumentNullException(nameof(mapper));
     if (eventingService == null) throw new ArgumentNullException(nameof(eventingService));
     if (emailService == null) throw new ArgumentNullException(nameof(emailService));
     if (cacheService == null) throw new ArgumentNullException(nameof(cacheService));
     _configurationService = configurationService;
     _databaseRepository = databaseRepository;
     _mapper = mapper;
     _eventingService = eventingService;
     _emailService = emailService;
     _cacheService = cacheService;
 }
Example #8
0
        public virtual void BeforeEachTest()
        {
            _container = new WindsorContainer();

            _container.Kernel.ComponentModelBuilder.AddContributor(new SingletonEqualizer());
            _container
                .Install(new AutoMapperInstaller())
                .Install(new ServiceInstaller())
                .Install(new ConfigurationInstaller())
                .Install(new DalInstaller());

            var documentDbBase = new DocumentDbBase(_container.Resolve<IDocumentStore>(), _container.Resolve<SeedService>());
            documentDbBase.Init();

            DatabaseRepository = _container.Resolve<IDatabaseRepository>();
        }
 public TestDbController(IDatabaseRepository databaseRepository)
 {
     _databaseRepository = databaseRepository;
 }
Example #10
0
 public GifManager(ITrendingService trendingService, ISearchService searchService, IDatabaseRepository databaseRepository)
 {
     this.trendingService    = trendingService;
     this.searchService      = searchService;
     this.databaseRepository = databaseRepository;
 }
 public DataSourceController(IDatabaseRepository dbRepo)
 {
     _dbRepo = dbRepo;
 }
Example #12
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("You must specify an option.  See /? for details");
                return;
            }
#if DEBUG
            Console.WriteLine("Stopped in order to attach debugger. Press any key to continue...");
            Console.ReadLine();
#endif
            if (args[0] == "/?")
            {
                Console.WriteLine("Mite - Simple and painless SQL migrations.\n\n");
                Console.WriteLine("Version " + Assembly.GetExecutingAssembly().GetName().Version);
                Console.WriteLine("mite.exe [-v] [init [filename]] [-c [filename]] [-d [destination]] [update/stepup/stepdown]\n\n");
                Console.WriteLine("Options are as follows:");
                Console.WriteLine("-v\t\tReturns the current version of Mite");
                Console.WriteLine(
                    "init\t\tCreates and opens the initial up file and makes.\n\t\tCreates the _migrations table and makes and entry into the \n\t\t_migrations table for the initial up.");
                Console.WriteLine("\t\tfilename(optional): desired filename of migration script");
                Console.WriteLine("-c\t\tCreates and launches the new migration files");
                Console.WriteLine("\t\tfilename(optional): desired filename of migration script");
                Console.WriteLine(
                    "-d\t\tSpecifies the destination version to migrate to.\n\t\t(can be greater than migrations available)");
                Console.WriteLine("update\t\tRuns all migrations greater than the current version");
                Console.WriteLine("stepup\t\tExecutes one migration file greater than the current version");
                Console.WriteLine("stepdown\tExecutes one migration file less than the current version");

                return;
            }

            if (args[0] == "-v")
            {
                Console.WriteLine("Mite Version " + Assembly.GetExecutingAssembly().GetName().Version);
                return;
            }
            if (args[0] == "-c")
            {
                try
                {
                    if (args.Count() > 1 && !string.IsNullOrEmpty(args[1]))
                    {
                        CreateMigration(args[1]);
                    }
                    else
                    {
                        CreateMigration();
                    }
                }
                catch (FormatException ex)
                {
                    Console.Write(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }


                return;
            }
            if (args[0] == "init")
            {
                if (!File.Exists(currentDirectory))
                {
                    Console.WriteLine("What provider are you using?");
                    Console.WriteLine("[1] MySqlDatabaseRepository");
                    Console.WriteLine("[2] MsSqlDatabaseRepository");
                    string repositoryName = "";
                    switch (Console.ReadLine()[0])
                    {
                    case '1':
                        repositoryName = "MySqlDatabaseRepository";
                        break;

                    case '2':
                        repositoryName = "MsSqlDatabaseRepository";
                        break;

                    default:
                        Console.WriteLine("Option not recognized");
                        return;
                    }
                    //determine the server
                    Console.WriteLine("Please enter your complete .Net connection string.");
                    string connectionString = Console.ReadLine();

                    //determine the database
                    JObject obj = new JObject();
                    obj["repositoryName"]   = repositoryName;
                    obj["connectionString"] = connectionString;
                    File.WriteAllText(Path.Combine(currentDirectory, "mite.config"), obj.ToString(Formatting.Indented));
                }

                try
                {
                    var tmpMigrator = MigratorFactory.GetMigrator(currentDirectory);
                    repo = tmpMigrator.DatabaseRepository;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }


                if (new DirectoryInfo(Environment.CurrentDirectory).GetFiles().Where(x => !x.Name.Contains("mite.config")).ToArray().Count() > 0)
                {
                    Console.WriteLine("Working directory is not clean.\nPlease ensure no existing scripts or project files exist when performing init.");
                    return;
                }


                var baseFileName = "";
                try
                {
                    if (args.Count() > 1 && !string.IsNullOrEmpty(args[1]))
                    {
                        baseFileName = GetMigrationFileName(args[1]);
                    }
                    else
                    {
                        baseFileName = GetMigrationFileName();
                    }
                }
                catch (FormatException ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.Write(ex.Message);
                    return;
                }

                var baseFilePath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + baseFileName;

                if (!File.Exists(baseFilePath))
                {
                    Console.WriteLine("Would you like me to generate a migration script based on the current database? [y|N]");
                    var generateScript = Console.ReadLine();
                    if (generateScript.ToLower() == "y")
                    {
                        bool includeData = false;
                        Console.WriteLine("Would you like to include the data? [y|N]");
                        var generateData = Console.ReadLine();
                        if (generateData.ToLower() == "y")
                        {
                            includeData = true;
                        }
                        try
                        {
                            var sql = repo.GenerateSqlScript(includeData);
                            File.WriteAllText(baseFilePath + ".sql", sql);
                            Console.WriteLine(string.Format("{0} generated successfully", baseFileName));
                            repo.RecordMigration(new Migration(baseFileName, sql, ""));
                        }
                        catch (Win32Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            Console.WriteLine("Using this feature requires that mysqldump be in your path.  Please add the path for mysqldump to your path variable and restart your cmd prompt.");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Use mite -c to create your first migration.");
                    }
                    return;
                }
                Console.WriteLine("Nothing to do.  Use mite -c to create your first migration.");
            }

            var migrator = MigratorFactory.GetMigrator(currentDirectory);
            var database = migrator.Tracker;
            repo = migrator.DatabaseRepository;

            MigrationResult resultingVersion = null;
            switch (args[0])
            {
            case "update":
                if (database.IsValidState())
                {
                    if (database.UnexcutedMigrations.Count() == 0)
                    {
                        Console.WriteLine("No migrations to execute");
                        Console.WriteLine("Current Version: " + database.Version);
                        return;
                    }
                    foreach (var migToExe in database.UnexcutedMigrations)
                    {
                        Console.WriteLine("Executing migration " + migToExe.Version);
                        repo.ExecuteUp(migToExe);
                    }
                }
                else if (database.IsMigrationGap())
                {
                    Console.WriteLine("There is a gap in your migrations how would you like to resolve it?");
                    Resolve(migrator);
                }
                else if (database.IsHashMismatch())
                {
                    Console.WriteLine("There is a mismatched checksum in your migrations, would you like me to resolve it? y|N\n This SHOULD NOT be performed in a production environment.");
                    if (Console.Read() == 'y')
                    {
                        Resolve(migrator);
                    }
                }
                break;

            case "-d":
                var version = "";
                if (args.Count() < 2)
                {
                    Console.WriteLine("ERROR: You have failed to specify a destination version.\nPlease determine your destination version and try again.");
                    return;
                }
                version          = args[1].Replace(".sql", "");
                resultingVersion = migrator.MigrateTo(version);
                Console.WriteLine("Current Version:" + resultingVersion.AfterMigration);
                break;

            case "status":
                Console.WriteLine("Current Version:" + database.Version);
                if (database.IsValidState())
                {
                    if (database.UnexcutedMigrations.Count() == 0)
                    {
                        Console.WriteLine("No migrations to execute");
                        return;
                    }
                }
                else
                {
                    if (database.IsHashMismatch())
                    {
                        var invalidMigrations = database.InvalidMigrations();
                        Console.WriteLine("The following migrations don't match their checksums:");
                        foreach (var mig in invalidMigrations)
                        {
                            Console.WriteLine(mig.Version);
                        }
                        return;
                    }
                    if (database.IsMigrationGap())
                    {
                        Console.WriteLine("The following migrations have not been executed:");
                        foreach (var mig in database.UnexcutedMigrations.Where(x => x.Version.CompareTo(database.Version) <= 0))
                        {
                            Console.WriteLine(mig.Version);
                        }
                    }
                }

                Console.WriteLine("Unexecuted Migrations:");
                foreach (var mig in database.UnexcutedMigrations)
                {
                    Console.WriteLine(mig.Version);
                }
                return;

            case "stepdown":
                resultingVersion = migrator.StepDown();
                break;

            case "stepup":
                resultingVersion = migrator.StepUp();
                break;

            case "verify":
                try
                {
                    migrator.Verify();
                    Console.WriteLine("All migrations have been verified and executed successfully");
                }
                catch (MigrationException ex)
                {
                    Console.WriteLine("Migrations could not be verified");
                    Console.WriteLine("The " + ex.Direction + " migration failed on: " + ex.Migration.Version);
                }
                break;

            case "version":
                Console.WriteLine("Database Version: " + database.Version);
                return;

            case "scratch":
                //drop all the tables and run all migrations
                migrator.FromScratch();
                Console.WriteLine("Database Version: " + database.Version);
                break;

            case "clean":
                Console.WriteLine("This will remove the mite.config and drop the _migrations table.  Are you sure you would like to clean (y/n)?");
                if (Console.ReadLine() == "y")
                {
                    repo.DropMigrationTable();
                    File.Delete(currentDirectory);
                    Console.WriteLine("mite cleaned successfully");
                }
                return;
            }
            if (resultingVersion != null)
            {
                Console.WriteLine(resultingVersion.Message);
            }
        }
 public AuthService(IDatabaseRepository <User> userRepository)
 {
     this.userRepository = (UserRepository)userRepository;
 }
Example #14
0
 public DataController(ILogger <DataController> logger, TenantDbContext tenantDbContext, IDatabaseRepository databaseRepository, IHttpContextAccessor httpContextAccessor)
 {
     _logger          = logger;
     _tenantDbContext = tenantDbContext;
     if (httpContextAccessor.HttpContext != null)
     {
         _tenant             = (Tenant)httpContextAccessor.HttpContext.Items["TENANT"];
         _databaseRepository = new DatabaseRepository(_tenantDbContext);
     }
 }
Example #15
0
 /// <summary>
 /// Pluralsight repository constructor
 /// </summary>
 /// <param name="dbRepository"></param>
 public PluralsightRepository(IDatabaseRepository dbRepository)
 {
     _dbRepository = dbRepository;
 }
 public OrdersModel(IDatabaseRepository databaseRepository)
 {
     _orderRepository = databaseRepository;
 }
 public DatabaseSubscription(IDatabaseRepository repository, IHubContext <BuyerHub> hubContext)
 {
     _repository = repository;
     _hubContext = hubContext;
 }
Example #18
0
 public PluralsightRepository()
 {
     _dbRepository = new DatabaseRepository(new PluralsightDbContext());
 }
Example #19
0
 public AccountController(IConstituencyService constituencyService, IDatabaseRepository db)
 {
     _constituencyService = constituencyService;
     _db = db;
 }
Example #20
0
 public DatabaseAppService(IDatabaseRepository repository)
 {
     _repository = repository;
 }
Example #21
0
 public DatabaseService(IDatabaseRepository repository)
 {
     this.repository = repository;
 }
 public ReportController(IDatabaseRepository repo)
 {
     _repo = repo;
 }
Example #23
0
 public AdminVendingMachineData(IDatabaseRepository databaseRepository)
 {
     _databaseRepository = databaseRepository;
     connection          = _databaseRepository.OpenConnection();
 }
 public OperationProjections(IDatabaseRepository databaseRepository, IUserProvider userProvider)
 {
     _userProvider       = userProvider ?? throw new ArgumentNullException(nameof(userProvider));
     _databaseRepository = databaseRepository ?? throw new ArgumentNullException(nameof(_databaseRepository));
 }
Example #25
0
 public Container(IDatabaseRepository <UserImages> databaseimages, IJsonCache <UserImages> cacheimage)
 {
     this.databaseimages = databaseimages;
     this.cacheimage     = cacheimage;
 }
 public BeaconService(IDatabaseRepository <Beacon> beaconRepository)
 {
     this.beaconRepository = (BeaconRepository)beaconRepository;
 }
 public BusinessServiceA(IDatabaseRepository repository)
 {
     this.repository = repository;
     this.guid       = Guid.NewGuid();
 }
 public ProductAttributeLookupRepository(IDatabaseRepository databaseRepository)
 {
     _databaseRepository = databaseRepository;
 }
Example #29
0
 public BalanceControllerService(IDatabaseRepository databaseRepository)
 {
     _databaseRepository = databaseRepository ?? throw new ArgumentNullException(nameof(databaseRepository));
 }
Example #30
0
 public void Init(IDatabaseRepository database)
 {
     implementation = new Lazy <IDatabaseRepository>(() => database, isThreadSafe: true);
 }
Example #31
0
 public SyncService(IScryfallService scryfall = null,
                    IDatabaseRepository db    = null)
 {
     _scryfall = scryfall ?? new ScryfallService();
     _db       = db ?? new DatabaseRepository();
 }
Example #32
0
 public VoteData(IDatabaseRepository db)
 {
     _db = db;
 }
Example #33
0
 public Migrator(IMigrationTracker tracker, IDatabaseRepository databaseRepository)
 {
     this.tracker = tracker;
     this.databaseRepository = databaseRepository;
 }
Example #34
0
 public ChartRepository(IDatabaseRepository database)
 {
     _database = database;
 }
Example #35
0
 /// <summary>
 /// Initilize Service.
 /// </summary>
 public DatabaseService()
 {
     _databaseRepository = new DatabaseRepository();
 }
Example #36
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("You must specify an option.  See /? for details");
                return;
            }
            #if DEBUG
            Console.WriteLine("Stopped in order to attach debugger. Press any key to continue...");
            Console.ReadLine();
            #endif
            if (args[0] == "/?")
            {
                Console.WriteLine("Mite - Simple and painless SQL migrations.\n\n");
                Console.WriteLine("Version " + Assembly.GetExecutingAssembly().GetName().Version);
                Console.WriteLine("mite.exe [-v] [init [filename]] [-c [filename]] [-d [destination]] [update/stepup/stepdown]\n\n");
                Console.WriteLine("Options are as follows:");
                Console.WriteLine("-v\t\tReturns the current version of Mite");
                Console.WriteLine(
                    "init\t\tCreates and opens the initial up file and makes.\n\t\tCreates the _migrations table and makes and entry into the \n\t\t_migrations table for the initial up.");
                Console.WriteLine("\t\tfilename(optional): desired filename of migration script");
                Console.WriteLine("-c\t\tCreates and launches the new migration files");
                Console.WriteLine("\t\tfilename(optional): desired filename of migration script");
                Console.WriteLine(
                    "-d\t\tSpecifies the destination version to migrate to.\n\t\t(can be greater than migrations available)");
                Console.WriteLine("update\t\tRuns all migrations greater than the current version");
                Console.WriteLine("stepup\t\tExecutes one migration file greater than the current version");
                Console.WriteLine("stepdown\tExecutes one migration file less than the current version");

                return;
            }

            if (args[0] == "-v")
            {
                Console.WriteLine("Mite Version " + Assembly.GetExecutingAssembly().GetName().Version);
                return;
            }
            if (args[0] == "-c")
            {
                try
                {
                    if (args.Count() > 1 && !string.IsNullOrEmpty(args[1]))
                    {
                        CreateMigration(args[1]);
                    }
                    else
                    {
                        CreateMigration();
                    }
                }
                catch (FormatException ex)
                {
                    Console.Write(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                return;
            }
            if (args[0] == "init")
            {

                if (!File.Exists(currentDirectory))
                {
                    Console.WriteLine("What provider are you using?");
                    Console.WriteLine("[1] MySqlDatabaseRepository");
                    Console.WriteLine("[2] MsSqlDatabaseRepository");
                    string repositoryName = "";
                    switch (Console.ReadLine()[0])
                    {
                        case '1':
                            repositoryName = "MySqlDatabaseRepository";
                            break;
                        case '2':
                            repositoryName = "MsSqlDatabaseRepository";
                            break;
                        default:
                            Console.WriteLine("Option not recognized");
                            return;
                    }
                    //determine the server
                    Console.WriteLine("Please enter your complete .Net connection string.");
                    string connectionString = Console.ReadLine();

                    //determine the database
                    JObject obj = new JObject();
                    obj["repositoryName"] = repositoryName;
                    obj["connectionString"] = connectionString;
                    File.WriteAllText(Path.Combine(currentDirectory, "mite.config"), obj.ToString(Formatting.Indented));
                }

                try
                {
                    var tmpMigrator = MigratorFactory.GetMigrator(currentDirectory);
                    repo = tmpMigrator.DatabaseRepository;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                if (new DirectoryInfo(Environment.CurrentDirectory).GetFiles().Where(x => !x.Name.Contains("mite.config")).ToArray().Count() > 0)
                {
                    Console.WriteLine("Working directory is not clean.\nPlease ensure no existing scripts or project files exist when performing init.");
                    return;
                }

                var baseFileName = "";
                try
                {
                    if (args.Count() > 1 && !string.IsNullOrEmpty(args[1]))
                    {
                        baseFileName = GetMigrationFileName(args[1]);
                    }
                    else
                    {
                        baseFileName = GetMigrationFileName();
                    }
                }
                catch (FormatException ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.Write(ex.Message);
                    return;
                }

                var baseFilePath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + baseFileName;

                if (!File.Exists(baseFilePath))
                {
                    Console.WriteLine("Would you like me to generate a migration script based on the current database? [y|N]");
                    var generateScript = Console.ReadLine();
                    if (generateScript.ToLower() == "y")
                    {
                        bool includeData = false;
                        Console.WriteLine("Would you like to include the data? [y|N]");
                        var generateData = Console.ReadLine();
                        if (generateData.ToLower() == "y")
                        {
                            includeData = true;
                        }
                        try
                        {
                            var sql = repo.GenerateSqlScript(includeData);
                            File.WriteAllText(baseFilePath + ".sql", sql);
                            Console.WriteLine(string.Format("{0} generated successfully", baseFileName));
                            repo.RecordMigration(new Migration(baseFileName, sql, ""));
                        }
                        catch (Win32Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            Console.WriteLine("Using this feature requires that mysqldump be in your path.  Please add the path for mysqldump to your path variable and restart your cmd prompt.");
                        }

                    }
                    else
                    {
                        Console.WriteLine("Use mite -c to create your first migration.");
                    }
                    return;
                }
                Console.WriteLine("Nothing to do.  Use mite -c to create your first migration.");
            }

            var migrator = MigratorFactory.GetMigrator(currentDirectory);
            var database = migrator.Tracker;
            repo = migrator.DatabaseRepository;

            MigrationResult resultingVersion = null;
            switch (args[0])
            {
                case "update":
                    if (database.IsValidState())
                    {
                        if (database.UnexcutedMigrations.Count() == 0)
                        {
                            Console.WriteLine("No migrations to execute");
                            Console.WriteLine("Current Version: " + database.Version);
                            return;
                        }
                        foreach (var migToExe in database.UnexcutedMigrations)
                        {
                            Console.WriteLine("Executing migration " + migToExe.Version);
                            repo.ExecuteUp(migToExe);
                        }
                    }
                    else if (database.IsMigrationGap())
                    {
                        Console.WriteLine("There is a gap in your migrations how would you like to resolve it?");
                        Resolve(migrator);
                    }
                    else if (database.IsHashMismatch())
                    {
                        Console.WriteLine("There is a mismatched checksum in your migrations, would you like me to resolve it? y|N\n This SHOULD NOT be performed in a production environment.");
                        if (Console.Read() == 'y')
                        {
                            Resolve(migrator);
                        }
                    }
                    break;
                case "-d":
                    var version = "";
                    if (args.Count() < 2)
                    {
                        Console.WriteLine("ERROR: You have failed to specify a destination version.\nPlease determine your destination version and try again.");
                        return;
                    }
                    version = args[1].Replace(".sql", "");
                    resultingVersion = migrator.MigrateTo(version);
                    Console.WriteLine("Current Version:" + resultingVersion.AfterMigration);
                    break;
                case "status":
                    Console.WriteLine("Current Version:" + database.Version);
                    if (database.IsValidState())
                    {
                        if (database.UnexcutedMigrations.Count() == 0)
                        {
                            Console.WriteLine("No migrations to execute");
                            return;
                        }
                    }
                    else
                    {
                        if (database.IsHashMismatch())
                        {
                            var invalidMigrations = database.InvalidMigrations();
                            Console.WriteLine("The following migrations don't match their checksums:");
                            foreach (var mig in invalidMigrations)
                            {
                                Console.WriteLine(mig.Version);
                            }
                            return;
                        }
                        if (database.IsMigrationGap())
                        {
                            Console.WriteLine("The following migrations have not been executed:");
                            foreach (var mig in database.UnexcutedMigrations.Where(x => x.Version.CompareTo(database.Version) <= 0))
                                Console.WriteLine(mig.Version);
                        }
                    }

                    Console.WriteLine("Unexecuted Migrations:");
                    foreach (var mig in database.UnexcutedMigrations)
                    {
                        Console.WriteLine(mig.Version);
                    }
                    return;
                case "stepdown":
                    resultingVersion = migrator.StepDown();
                    break;
                case "stepup":
                    resultingVersion = migrator.StepUp();
                    break;
                case "verify":
                    try
                    {
                        migrator.Verify();
                        Console.WriteLine("All migrations have been verified and executed successfully");
                    }
                    catch (MigrationException ex)
                    {
                        Console.WriteLine("Migrations could not be verified");
                        Console.WriteLine("The " + ex.Direction + " migration failed on: " + ex.Migration.Version);
                    }
                    break;
                case "version":
                    Console.WriteLine("Database Version: " + database.Version);
                    return;
                case "scratch":
                    //drop all the tables and run all migrations
                    migrator.FromScratch();
                    Console.WriteLine("Database Version: " + database.Version);
                    break;
                case "clean":
                    Console.WriteLine("This will remove the mite.config and drop the _migrations table.  Are you sure you would like to clean (y/n)?");
                    if (Console.ReadLine() == "y")
                    {
                        repo.DropMigrationTable();
                        File.Delete(currentDirectory);
                        Console.WriteLine("mite cleaned successfully");
                    }
                    return;
            }
            if (resultingVersion != null)
            {
                Console.WriteLine(resultingVersion.Message);
            }
        }
 public BalanceControllerService(IDatabaseRepository databaseRepository)
 {
     if (databaseRepository == null) throw new ArgumentNullException(nameof(databaseRepository));
     _databaseRepository = databaseRepository;
 }
Example #38
0
 public AdminController(SignInManager <CreateUsers> loginandresult, RoleManager <IdentityRole> roles, IDatabaseRepository <UserImages> usim)
 {
     this.roles          = roles;
     this.loginandresult = loginandresult;
     this.usim           = usim;
 }
Example #39
0
 public FeedbackRepository(IDatabaseRepository databaseRepository, IGuidRepository guidRepository, IDateRepository dateRepository)
 {
     _databaseRepository = databaseRepository;
     _guidRepository     = guidRepository;
     _dateRepository     = dateRepository;
 }
Example #40
0
 private DataConnection()
 {
     _repo = new DatabaseRepository(ConfigurationManager.ConnectionStrings["Default"].ConnectionString);
 }
 public LocationService(IDatabaseRepository <Location> locationRepository, IAzureService azureService)
 {
     this.locationRepository = (LocationRepository)locationRepository;
     this.azureService       = azureService;
 }
Example #42
0
 public UserService(IDatabaseRepository db)
 {
     _db = db;
 }
Example #43
0
 public ApplicationController(IDatabaseRepository repo)
 {
     _repo = repo;
 }
Example #44
0
 public MemoryCacheService(IDatabaseRepository databaseRepository)
 {
     if (databaseRepository == null) throw new ArgumentNullException(nameof(databaseRepository));
     _databaseRepository = databaseRepository;
 }
Example #45
0
 public EventService(IDatabaseRepository <Event> eventRepository, IDatabaseRepository <User> userRepository, IAzureService azureService)
 {
     this.eventRepository = (EventRepository)eventRepository;
     this.userRepository  = (UserRepository)userRepository;
     this.azureService    = azureService;
 }