diff --git a/DapperSample/global.json b/DapperSample/global.json index d76e72f..1cc381b 100644 --- a/DapperSample/global.json +++ b/DapperSample/global.json @@ -1,6 +1,6 @@ { "projects": [ "src" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/DapperSample/src/DapperSample/DapperSample.csproj b/DapperSample/src/DapperSample/DapperSample.csproj index 6cf11ec..dc53612 100644 --- a/DapperSample/src/DapperSample/DapperSample.csproj +++ b/DapperSample/src/DapperSample/DapperSample.csproj @@ -1,46 +1,24 @@  - netcoreapp1.1 + netcoreapp2.1 true DapperSample Exe DapperSample - 1.1.2 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 + 2.1.0 + $(PackageTargetFallback) - - - - - - - - - - - - + + - - - - - - - - - All - - + + + - - - - diff --git a/DapperSample/src/DapperSample/Startup.cs b/DapperSample/src/DapperSample/Startup.cs index 9f100a9..5d8fcec 100644 --- a/DapperSample/src/DapperSample/Startup.cs +++ b/DapperSample/src/DapperSample/Startup.cs @@ -47,7 +47,8 @@ public void ConfigureServices(IServiceCollection services) options.UseSqlite(Configuration["Data:DefaultConnection:ConnectionString"]); }); } - if(dbkind.Equals("sqlserver")) + + if (dbkind.Equals("sqlserver")) { services.AddEntityFrameworkSqlServer(); services.AddDbContext(options => @@ -55,7 +56,8 @@ public void ConfigureServices(IServiceCollection services) options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]); }); } - if(dbkind.Equals("postgresql")) + + if (dbkind.Equals("postgresql")) { services.AddEntityFrameworkNpgsql(); services.AddDbContext(options => @@ -63,7 +65,8 @@ public void ConfigureServices(IServiceCollection services) options.UseNpgsql(Configuration["Data:DefaultConnection:ConnectionString"]); }); } - if(dbkind.Equals("inmemory")) + + if (dbkind.Equals("inmemory")) { services.AddEntityFrameworkInMemoryDatabase(); services.AddDbContext(options => @@ -71,6 +74,7 @@ public void ConfigureServices(IServiceCollection services) options.UseInMemoryDatabase(); }); } + // Add framework services. services.AddMvc(); services.AddSwaggerGen(c => @@ -108,6 +112,17 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF { c.SwaggerEndpoint("/api-docs/v1/swagger.json", "My API V1"); }); + + Initialize(app); + } + + private void Initialize(IApplicationBuilder app) + { + using (var serviceScope = app.ApplicationServices.GetRequiredService().CreateScope()) + { + var context = serviceScope.ServiceProvider.GetService(); + context.Database.EnsureCreated(); + } } } } diff --git a/GroongaSample/global.json b/GroongaSample/global.json index d76e72f..1cc381b 100644 --- a/GroongaSample/global.json +++ b/GroongaSample/global.json @@ -1,6 +1,6 @@ { "projects": [ "src" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/GroongaSample/src/WebApiSample/Program.cs b/GroongaSample/src/WebApiSample/Program.cs index da94e49..326817d 100644 --- a/GroongaSample/src/WebApiSample/Program.cs +++ b/GroongaSample/src/WebApiSample/Program.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore; namespace WebApiSample { @@ -12,14 +13,11 @@ public class Program { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .Build(); - - host.Run(); + CreateWebHostBuilder(args).Build().Run(); } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); } } diff --git a/GroongaSample/src/WebApiSample/WebApiSample.csproj b/GroongaSample/src/WebApiSample/WebApiSample.csproj index eaa3cc4..1550be9 100644 --- a/GroongaSample/src/WebApiSample/WebApiSample.csproj +++ b/GroongaSample/src/WebApiSample/WebApiSample.csproj @@ -1,45 +1,21 @@ - netcoreapp1.1 + netcoreapp2.1 true WebApiSample Exe WebApiSample - 1.1.2 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 + 2.1.0 + $(PackageTargetFallback) - - - - - - - - - - - + - - - All - - - - - - - - All - - - - - + + diff --git a/PortableLib/global.json b/PortableLib/global.json index d76e72f..386035d 100644 --- a/PortableLib/global.json +++ b/PortableLib/global.json @@ -1,6 +1,5 @@ { - "projects": [ "src" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/PortableLib/src/Sample/Sample.csproj b/PortableLib/src/Sample/Sample.csproj index a53f498..81851f6 100644 --- a/PortableLib/src/Sample/Sample.csproj +++ b/PortableLib/src/Sample/Sample.csproj @@ -1,13 +1,12 @@  - netstandard1.6;net461 + netstandard2.0;net461 portable true Sample Sample - $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+net461+win8 - 1.6.1 + $(PackageTargetFallback); @@ -15,4 +14,6 @@ + + diff --git a/PortableLib/src/WpfApplication/WpfApplication.csproj b/PortableLib/src/WpfApplication/WpfApplication.csproj index 7b041c0..11e72e5 100644 --- a/PortableLib/src/WpfApplication/WpfApplication.csproj +++ b/PortableLib/src/WpfApplication/WpfApplication.csproj @@ -1,5 +1,5 @@  - + Debug @@ -131,6 +131,11 @@ Sample + + + 2.0.1 + + - - All - - + + - - All - - - All - - - All - - - All - - - + diff --git a/WebAppScaffoldSample/global.json b/WebAppScaffoldSample/global.json index d76e72f..1cc381b 100644 --- a/WebAppScaffoldSample/global.json +++ b/WebAppScaffoldSample/global.json @@ -1,6 +1,6 @@ { "projects": [ "src" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/WebAppScaffoldSample/src/WebApplication/.bowerrc b/WebAppScaffoldSample/src/WebApplication/.bowerrc index 6406626..46ac6f5 100644 --- a/WebAppScaffoldSample/src/WebApplication/.bowerrc +++ b/WebAppScaffoldSample/src/WebApplication/.bowerrc @@ -1,3 +1,4 @@ { - "directory": "wwwroot/lib" + "directory": "wwwroot/lib", + "registry": "https://registry.bower.io" } diff --git a/WebAppScaffoldSample/src/WebApplication/Startup.cs b/WebAppScaffoldSample/src/WebApplication/Startup.cs index 6ff8653..d0d902e 100644 --- a/WebAppScaffoldSample/src/WebApplication/Startup.cs +++ b/WebAppScaffoldSample/src/WebApplication/Startup.cs @@ -47,11 +47,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); - app.UseBrowserLink(); + //app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); } app.UseStaticFiles(); diff --git a/WebAppScaffoldSample/src/WebApplication/WebApplication.csproj b/WebAppScaffoldSample/src/WebApplication/WebApplication.csproj index 1a6dcda..4bc2f2b 100644 --- a/WebAppScaffoldSample/src/WebApplication/WebApplication.csproj +++ b/WebAppScaffoldSample/src/WebApplication/WebApplication.csproj @@ -1,13 +1,13 @@  - netcoreapp1.1 + netcoreapp2.1 true WebApplication Exe WebApplication - 1.1.2 - $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; + 2.1.0 + $(PackageTargetFallback) @@ -17,38 +17,9 @@ - - - - - - - - - - - - - - - - - - - All - - - - All - - - - All - + + + @@ -60,10 +31,7 @@ - - - All - + diff --git a/WebAppScaffoldSample/src/WebApplication/appsettings.json b/WebAppScaffoldSample/src/WebApplication/appsettings.json index 25da1f3..db22985 100644 --- a/WebAppScaffoldSample/src/WebApplication/appsettings.json +++ b/WebAppScaffoldSample/src/WebApplication/appsettings.json @@ -1,7 +1,7 @@ { "Data": { "DefaultConnection": { - "ConnectionString": "Data Source=..\\..\\..\\db.sqlite" + "ConnectionString": "Data Source=db.sqlite" } }, "Logging": { diff --git a/cakebuild/NuGet.config b/cakebuild/NuGet.config index 9f494fd..7604d00 100644 --- a/cakebuild/NuGet.config +++ b/cakebuild/NuGet.config @@ -1,8 +1,7 @@  - - + diff --git a/cakebuild/build.cake b/cakebuild/build.cake index fa87363..60e4d4b 100644 --- a/cakebuild/build.cake +++ b/cakebuild/build.cake @@ -9,8 +9,8 @@ var buildArtifacts = Directory("./artifacts/packages"); var isAppVeyor = AppVeyor.IsRunningOnAppVeyor; var isWindows = IsRunningOnWindows(); -var netcore = "netcoreapp1.1"; -var netstandard = "netstandard1.6"; +var netcore = "netcoreapp2.1"; +var netstandard = "netstandard2.0"; /////////////////////////////////////////////////////////////////////////////// // Clean diff --git a/cakebuild/global.json b/cakebuild/global.json index 194114a..386035d 100644 --- a/cakebuild/global.json +++ b/cakebuild/global.json @@ -1,6 +1,5 @@ { - "projects": [ "src", "test" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/cakebuild/src/Sample/Sample.csproj b/cakebuild/src/Sample/Sample.csproj index 7ca0712..c8188ed 100644 --- a/cakebuild/src/Sample/Sample.csproj +++ b/cakebuild/src/Sample/Sample.csproj @@ -1,13 +1,13 @@  - netcoreapp1.1 + netcoreapp2.0 portable true Sample Sample - 1.1.2 - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 + 2.0.0 + $(PackageTargetFallback) diff --git a/cakebuild/test/Sample.Tests/Sample.Tests.csproj b/cakebuild/test/Sample.Tests/Sample.Tests.csproj index 36e9ee3..7d65af8 100644 --- a/cakebuild/test/Sample.Tests/Sample.Tests.csproj +++ b/cakebuild/test/Sample.Tests/Sample.Tests.csproj @@ -1,13 +1,14 @@ - netcoreapp1.1 + netcoreapp2.1 portable Sample.Tests Sample.Tests true - $(PackageTargetFallback);dotnet5.4;portable-net451+win8 - 1.1.2 + $(PackageTargetFallback) + 2.0.0 + false @@ -15,10 +16,10 @@ - + - + diff --git a/console/global.json b/console/global.json index d76e72f..386035d 100644 --- a/console/global.json +++ b/console/global.json @@ -1,6 +1,5 @@ { - "projects": [ "src" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/console/src/src.csproj b/console/src/src.csproj index 698b553..dc06528 100644 --- a/console/src/src.csproj +++ b/console/src/src.csproj @@ -1,13 +1,13 @@  - netcoreapp1.1 + netcoreapp2.1 portable src Exe src $(PackageTargetFallback) - 1.1.2 + 2.1.0 @@ -15,8 +15,8 @@ win10-x64 - - + + diff --git a/ef/NuGet.config b/ef/NuGet.config index d2c31a0..7604d00 100644 --- a/ef/NuGet.config +++ b/ef/NuGet.config @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/ef/global.json b/ef/global.json index d76e72f..386035d 100644 --- a/ef/global.json +++ b/ef/global.json @@ -1,6 +1,5 @@ { - "projects": [ "src" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/ef/src/Models/Company.cs b/ef/src/Models/Company.cs index a4835c2..560faeb 100644 --- a/ef/src/Models/Company.cs +++ b/ef/src/Models/Company.cs @@ -1,12 +1,12 @@ -using System.Collections.Generic; - -namespace ef.Models -{ - public class Company - { - public int id { get; set; } - public string Name { get; set; } - public int Capital { get; set; } - public List Employees { get; set; } - } +using System.Collections.Generic; + +namespace ef.Models +{ + public class Company + { + public int id { get; set; } + public string Name { get; set; } + public int Capital { get; set; } + public List Employees { get; set; } + } } \ No newline at end of file diff --git a/ef/src/Models/CoreExampleContext.cs b/ef/src/Models/CoreExampleContext.cs index 7d1965a..120fe48 100644 --- a/ef/src/Models/CoreExampleContext.cs +++ b/ef/src/Models/CoreExampleContext.cs @@ -4,6 +4,8 @@ namespace ef.Models { + using System; + public class CoreExampleContext : DbContext { public DbSet Company { get; set; } @@ -42,7 +44,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) } if (dbkind.Equals("inmemory")) { - optionsBuilder.UseInMemoryDatabase(); + optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString()); } } } diff --git a/ef/src/Models/Employee.cs b/ef/src/Models/Employee.cs index 2b416ed..c52e699 100644 --- a/ef/src/Models/Employee.cs +++ b/ef/src/Models/Employee.cs @@ -1,11 +1,11 @@ -using System.Collections.Generic; - -namespace ef.Models -{ - public class Employee - { - public int id { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - } +using System.Collections.Generic; + +namespace ef.Models +{ + public class Employee + { + public int id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } } \ No newline at end of file diff --git a/ef/src/Program.cs b/ef/src/Program.cs index 9a24c13..35b5230 100644 --- a/ef/src/Program.cs +++ b/ef/src/Program.cs @@ -15,6 +15,7 @@ namespace ef { public class Program { + /* private static DbContextOptions CreateNewContextOptions() { var serviceProvider = new ServiceCollection() @@ -27,6 +28,8 @@ private static DbContextOptions CreateNewContextOptions() return builder.Options; } + */ + private static IConfigurationRoot Configuration { get; set; } private static IHostingEnvironment HostingEnvironment { get; set; } @@ -73,7 +76,7 @@ public static void Main(string[] args) service.AddEntityFrameworkInMemoryDatabase(); service.AddDbContext(options => { - options.UseInMemoryDatabase(); + options.UseInMemoryDatabase(Guid.NewGuid().ToString()); }); } @@ -88,7 +91,7 @@ public static void Main(string[] args) //EnsureSeedData(serviceScope.ServiceProvider.GetService()); } } - + /* public static void EnsureDatabaseCreated() { var optionsBuilder = new DbContextOptionsBuilder(); @@ -104,5 +107,6 @@ public static void EnsureDatabaseCreated() else if (HostingEnvironment.IsProduction()) optionsBuilder.UseSqlServer(Configuration["Data:live:TransientContext"]); new CoreExampleContext(optionsBuilder.Options).Database.EnsureCreated(); } + */ } } diff --git a/ef/src/appsettings.json b/ef/src/appsettings.json index 8114dea..5ab31b1 100644 --- a/ef/src/appsettings.json +++ b/ef/src/appsettings.json @@ -2,7 +2,7 @@ "Data": { "DefaultConnection": { "ConnectionDBString": "sqlite", - "ConnectionString": "Data Source=..\\..\\..\\db.sqlite" + "ConnectionString": "Data Source=db.sqlite" } /* "DefaultConnection": { diff --git a/ef/src/src.csproj b/ef/src/src.csproj index ee1b30a..c03bfee 100644 --- a/ef/src/src.csproj +++ b/ef/src/src.csproj @@ -1,46 +1,21 @@ - + - netcoreapp1.1 + netcoreapp2.1 portable - src + ef Exe - src - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 - win10-x64;osx.10.11-x64;ubuntu.16.04-x64 - 1.1.2 + ef + $(PackageTargetFallback); + win7-x86;win10-x64;osx.10.11-x64;ubuntu.16.04-x64 + 2.1.0 - - All - - - - - - All - - - All - - - All - - - All - - - - - - - - - - - - + + + + diff --git a/scaffold/global.json b/scaffold/global.json index d76e72f..386035d 100644 --- a/scaffold/global.json +++ b/scaffold/global.json @@ -1,6 +1,5 @@ { - "projects": [ "src" ], "sdk": { - "version": "1.1.0" + "version": "2.1.300" } } \ No newline at end of file diff --git a/scaffold/src/scaffold.txt b/scaffold/src/scaffold.txt index 0030243..20ccac5 100644 --- a/scaffold/src/scaffold.txt +++ b/scaffold/src/scaffold.txt @@ -1 +1,3 @@ -dotnet ef dbcontext scaffold "Data Source=..\..\..\db.sqlite" Microsoft.EntityFrameworkCore.Sqlite -o Models \ No newline at end of file +dotnet ef dbcontext scaffold "Data Source=db.sqlite" Microsoft.EntityFrameworkCore.Sqlite -o Models +dotnet ef dbcontext scaffold "Data Source=db.sqlite" Microsoft.EntityFrameworkCore.Sqlite -o Models -t Company +dotnet ef dbcontext scaffold "Data Source=db.sqlite" Microsoft.EntityFrameworkCore.Sqlite -o Models -c AbcDbContext \ No newline at end of file diff --git a/scaffold/src/src.csproj b/scaffold/src/src.csproj index 2638cc6..4f49eda 100644 --- a/scaffold/src/src.csproj +++ b/scaffold/src/src.csproj @@ -1,29 +1,20 @@  - netcoreapp1.1 + netcoreapp2.1 portable true src Exe src true - 1.1.2 - $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + 2.1.0 + $(PackageTargetFallback); - - - All - - - All - - - - - + +