public Tests.Artifacts.BackOffice.Db_MySQL CreateDbContext(string[] args)
        {
            string connectionString           = ConnectionstringUtility.BuildConnectionString(ConnectionstringUtility.GetConnectionString("bin\\debug\\netcoreapp2.0\\EndPoints.json", API_Name.BackOffice, DataBaseProviderName.MySQL));
            DbContextOptionsBuilder dbOptions = new DbContextOptionsBuilder();

            dbOptions.UseMySql(ServerVersion.AutoDetect(connectionString));
            Tests.Artifacts.BackOffice.Db_MySQL db = new Tests.Artifacts.BackOffice.Db_MySQL(dbOptions.Options);
            return(db);
        }
Example #2
0
        public Tests.Artifacts.StoreFront.Db_MSSQL CreateDbContext(string[] args)
        {
            string connectionString           = ConnectionstringUtility.GetConnectionString("bin\\debug\\netcoreapp2.0\\EndPoints.json", API_Name.StoreFront, DataBaseProviderName.MSSQL);
            DbContextOptionsBuilder dbOptions = new DbContextOptionsBuilder();

            dbOptions.UseSqlServer(connectionString);
            Tests.Artifacts.StoreFront.Db_MSSQL db = new Tests.Artifacts.StoreFront.Db_MSSQL(dbOptions.Options);
            return(db);
        }
Example #3
0
    public Zamagon.Services.StoreFront.Database.Db_MySQL CreateDbContext(string[] args)
    {
        string connectionString           = ConnectionstringUtility.BuildConnectionString(ConnectionstringUtility.GetConnectionString(Constants.EndPointsFile, API_Name.StoreFront, DataBaseProviderName.MySQL));
        DbContextOptionsBuilder dbOptions = new DbContextOptionsBuilder();

        dbOptions.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString));
        Zamagon.Services.StoreFront.Database.Db_MySQL db = new Zamagon.Services.StoreFront.Database.Db_MySQL(dbOptions.Options);
        return(db);
    }
Example #4
0
    public Zamagon.Services.BackOffice.Database.Db_MSSQL CreateDbContext(string[] args)
    {
        string connectionString           = ConnectionstringUtility.GetConnectionString(Constants.EndPointsFile, API_Name.BackOffice, DataBaseProviderName.MSSQL);
        DbContextOptionsBuilder dbOptions = new DbContextOptionsBuilder();

        dbOptions.UseSqlServer(connectionString);
        Zamagon.Services.BackOffice.Database.Db_MSSQL db = new Zamagon.Services.BackOffice.Database.Db_MSSQL(dbOptions.Options);
        return(db);
    }
Example #5
0
        public static IEnumerable <IEndPointConfiguration> ReadEndPointsFromDisk()
        {
            List <IEndPointConfiguration> endPoints   = EndPointUtilities.LoadEndPoints(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "appsettings.json")).ToList();
            IEndPointConfiguration        backOffice  = endPoints.FirstOrDefault(x => x.API_Name == API_Name.BackOffice && x.ProviderName == DataBaseProviderName.MySQL);
            IEndPointConfiguration        frontOffice = endPoints.FirstOrDefault(x => x.API_Name == API_Name.StoreFront && x.ProviderName == DataBaseProviderName.MySQL);

            if (backOffice != null)
            {
                backOffice.ConnectionString = ConnectionstringUtility.BuildConnectionString(endPoints.First(x => x.API_Name == API_Name.BackOffice && x.ProviderName == DataBaseProviderName.MySQL).ConnectionString);
            }

            if (frontOffice != null)
            {
                frontOffice.ConnectionString = ConnectionstringUtility.BuildConnectionString(endPoints.First(x => x.API_Name == API_Name.StoreFront && x.ProviderName == DataBaseProviderName.MySQL).ConnectionString);
            }

            return(endPoints);
        }
Example #6
0
        protected async Task CreateTestArtifacts()
        {
            EndPoints = EndPointUtilities.LoadEndPoints("EndPoints.json");
            if (EndPoints.Any(x => x.ProviderName == DataBaseProviderName.MySQL))
            {
                EndPoints.First(x => x.API_Name == API_Name.BackOffice && x.ProviderName == DataBaseProviderName.MySQL).ConnectionString = ConnectionstringUtility.BuildConnectionString(EndPoints.First(x => x.API_Name == API_Name.BackOffice && x.ProviderName == DataBaseProviderName.MySQL).ConnectionString);
                EndPoints.First(x => x.API_Name == API_Name.StoreFront && x.ProviderName == DataBaseProviderName.MySQL).ConnectionString = ConnectionstringUtility.BuildConnectionString(EndPoints.First(x => x.API_Name == API_Name.StoreFront && x.ProviderName == DataBaseProviderName.MySQL).ConnectionString);
            }
            ContainerBuilder builder = new ContainerBuilder();

            builder.RegisterModule(new LeaderAnalytics.AdaptiveClient.EntityFrameworkCore.AutofacModule());
            RegistrationHelper registrationHelper = new RegistrationHelper(builder);

            registrationHelper.RegisterEndPoints(EndPoints);
            registrationHelper.RegisterModule(new Zamagon.Services.BackOffice.AdaptiveClientModule());
            registrationHelper.RegisterModule(new Zamagon.Services.Common.AdaptiveClientModule());
            registrationHelper.RegisterModule(new Zamagon.Services.StoreFront.AdaptiveClientModule());
            Container         = builder.Build();
            BOServiceClient   = Container.Resolve <IAdaptiveClient <IBOServiceManifest> >();
            SFServiceClient   = Container.Resolve <IAdaptiveClient <ISFServiceManifest> >();
            DatabaseUtilities = Container.Resolve <IDatabaseUtilities>();
        }