Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            //docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=P@ssw0rd!" -p 1400:1433 -d mcr.microsoft.com/mssql/server:2017-latest
            var traceService = new ConsoleTraceService {
                IsDebugEnabled = true
            };

            app.UseYuniql(traceService, new YuniqlConfiguration
            {
                WorkspacePath      = Path.Combine(Environment.CurrentDirectory, "_db"),
                ConnectionString   = "Server=localhost,1400;Database=yuniqldb;User Id=SA;Password=P@ssw0rd!",
                AutoCreateDatabase = true,
                Tokens             = new List <KeyValuePair <string, string> > {
                    new KeyValuePair <string, string>("VwColumnPrefix1", "Vw1"),
                    new KeyValuePair <string, string>("VwColumnPrefix2", "Vw2"),
                    new KeyValuePair <string, string>("VwColumnPrefix3", "Vw3"),
                    new KeyValuePair <string, string>("VwColumnPrefix4", "Vw4")
                }
            });

            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapGet("/", async context =>
                {
                    await context.Response.WriteAsync("Hello World!");
                });
            });
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            //1. deploy new sql server on docker
            //$ docker run -dit --name yuniql-sqlserver  -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=P@ssw0rd!" -p 1400:1433 -d mcr.microsoft.com/mssql/server:2017-latest

            //2. create custom trace message sinks, this can be your own logger framework
            var traceService = new ConsoleTraceService {
                IsDebugEnabled = true
            };

            //3. run migrations
            app.UseYuniql(traceService, new Yuniql.AspNetCore.Configuration
            {
                Platform             = "sqlserver",
                Workspace            = Path.Combine(Environment.CurrentDirectory, "_db"),
                ConnectionString     = "Server=localhost,1400;Database=helloyuniql;User Id=SA;Password=P@ssw0rd!",
                IsAutoCreateDatabase = true, IsDebug = true
            });

            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapGet("/", async context =>
                {
                    await context.Response.WriteAsync("Hello World!");
                });
            });
        }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            //docker run -e POSTGRES_USER=sa -e POSTGRES_PASSWORD=P@ssw0rd! -e POSTGRES_DB=yuniqldb -p 5432:5432 postgres
            var traceService = new ConsoleTraceService {
                IsDebugEnabled = true
            };
            var configuration =
                app.UseYuniql(
                    new PostgreSqlDataService(traceService),
                    new PostgreSqlBulkImportService(traceService),
                    traceService, new YuniqlConfiguration
            {
                WorkspacePath      = Path.Combine(Environment.CurrentDirectory, "_db"),
                ConnectionString   = "Host=localhost;Port=5432;Username=sa;Password=P@ssw0rd!;Database=yuniqldb",
                AutoCreateDatabase = true
            });

            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapGet("/", async context =>
                {
                    await context.Response.WriteAsync("Hello World!");
                });
            });
        }
Esempio n. 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            //1. deploy new postgresql on docker
            //$ docker run -dit -e POSTGRES_USER=sa -e POSTGRES_PASSWORD=P@ssw0rd! -e POSTGRES_DB=yuniqldb -p 5432:5432 postgres

            //2. create custom trace message sinks
            var traceService = new ConsoleTraceService {
                IsDebugEnabled = true
            };

            //3. run migrations
            app.UseYuniql(
                //use Yuniql.PostgreSql providers here
                new PostgreSqlDataService(traceService),
                new PostgreSqlBulkImportService(traceService),
                traceService, new Configuration
            {
                WorkspacePath      = Path.Combine(Environment.CurrentDirectory, "_db"),
                ConnectionString   = "Host=localhost;Port=5432;Username=sa;Password=P@ssw0rd!;Database=yuniqldb",
                AutoCreateDatabase = true, DebugTraceMode = true
            });;

            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapGet("/", async context =>
                {
                    await context.Response.WriteAsync("Hello World!");
                });
            });
        }