Skip to content

Commit decb87e

Browse files
committed
Merge branch 'migration/net11'
# Conflicts: # docs/architecting-and-developing-containerized-and-microservice-based-net-applications-ebook-early-draft.pdf # src/Services/Ordering/Ordering.API/Startup.cs
2 parents e4d0299 + 834bc46 commit decb87e

43 files changed

Lines changed: 428 additions & 264 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eShopOnContainers-ServicesAndWebApps.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "UnitTest", "test\Services\U
4747
EndProject
4848
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Identity", "Identity", "{24CD3B53-141E-4A07-9B0D-796641E1CF78}"
4949
EndProject
50-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Identity.API", "src\Services\Identity\eShopOnContainers.Identity\Identity.API.xproj", "{A579E108-5445-403D-A407-339AC4D1611B}"
50+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Identity.API", "src\Services\Identity\Identity.API\Identity.API.xproj", "{A579E108-5445-403D-A407-339AC4D1611B}"
5151
EndProject
5252
Global
5353
GlobalSection(SolutionConfigurationPlatforms) = preSolution

src/Services/Basket/Basket.API/Controllers/BasketController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
1010
{
11-
//NOTE: Right now this is a very chunky API, as the app evolves it is possible we would
11+
//TODO NOTE: Right now this is a very chunky API, as the app evolves it is possible we would
1212
//want to make the actions more fine graned, add basket item as an action for example.
1313
//If this is the case we should also investigate changing the serialization format used for Redis,
1414
//using a HashSet instead of a simple string.

src/Services/Basket/Basket.API/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM microsoft/aspnetcore:1.0.1
1+
FROM microsoft/aspnetcore:1.1
22
ENTRYPOINT ["dotnet", "Basket.API.dll"]
33
ARG source=.
44
WORKDIR /app

src/Services/Basket/Basket.API/Model/RedisBasketRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class RedisBasketRepository : IBasketRepository
1818
private ConnectionMultiplexer _redis;
1919

2020

21-
public RedisBasketRepository(IOptions<BasketSettings> options, ILoggerFactory loggerFactory)
21+
public RedisBasketRepository(IOptionsSnapshot<BasketSettings> options, ILoggerFactory loggerFactory)
2222
{
2323
_settings = options.Value;
2424
_logger = loggerFactory.CreateLogger<RedisBasketRepository>();

src/Services/Basket/Basket.API/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void ConfigureServices(IServiceCollection services)
4444
//that cost to startup instead of having the first request pay the
4545
//penalty.
4646
services.AddSingleton<ConnectionMultiplexer>((sp) => {
47-
var config = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
47+
var config = sp.GetRequiredService<IOptionsSnapshot<BasketSettings>>().Value;
4848
var ips = Dns.GetHostAddressesAsync(config.ConnectionString).Result;
4949
return ConnectionMultiplexer.Connect(ips.First().ToString());
5050
});

src/Services/Basket/Basket.API/project.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"dependencies": {
33
"Microsoft.NETCore.App": {
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"type": "platform"
66
},
7-
"System.Threading": "4.0.11",
8-
"Microsoft.AspNetCore.Mvc": "1.0.0",
9-
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
10-
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
11-
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
12-
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
13-
"Microsoft.Extensions.Configuration.Json": "1.0.0",
14-
"Microsoft.Extensions.Logging": "1.0.0",
15-
"Microsoft.Extensions.Logging.Console": "1.0.0",
16-
"Microsoft.Extensions.Logging.Debug": "1.0.0",
17-
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
7+
"System.Threading": "4.3.0",
8+
"Microsoft.AspNetCore.Mvc": "1.1.0",
9+
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
10+
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
11+
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
12+
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
13+
"Microsoft.Extensions.Configuration.Json": "1.1.0",
14+
"Microsoft.Extensions.Logging": "1.1.0",
15+
"Microsoft.Extensions.Logging.Console": "1.1.0",
16+
"Microsoft.Extensions.Logging.Debug": "1.1.0",
17+
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
1818
"StackExchange.Redis": "1.1.608",
1919
"Newtonsoft.Json": "9.0.1",
2020
"IdentityServer4.AccessTokenValidation": "1.0.1-rc3",
@@ -24,10 +24,11 @@
2424
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
2525
},
2626
"frameworks": {
27-
"netcoreapp1.0": {
27+
"netcoreapp1.1": {
2828
"imports": [
29-
"dotnet5.6",
30-
"portable-net45+win8"
29+
"netstandard1.6.1",
30+
"dnxcore50",
31+
"portable-net451+win8"
3132
]
3233
}
3334
},

src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-

1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
4+
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
5+
using Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel;
6+
using Microsoft.Extensions.Options;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Threading.Tasks;
10+
211
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
312
{
4-
using Extensions.Options;
5-
using Microsoft.AspNetCore.Mvc;
6-
using Microsoft.EntityFrameworkCore;
7-
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
8-
using Model;
9-
using System;
10-
using System.Collections.Generic;
11-
using System.Linq;
12-
using System.Threading.Tasks;
13-
using ViewModel;
14-
1513
[Route("api/v1/[controller]")]
1614
public class CatalogController : ControllerBase
1715
{
1816
private readonly CatalogContext _context;
19-
private readonly IOptions<Settings> _settings;
17+
private readonly IOptionsSnapshot<Settings> _settings;
2018

21-
public CatalogController(CatalogContext context, IOptions<Settings> settings)
19+
public CatalogController(CatalogContext context, IOptionsSnapshot<Settings> settings)
2220
{
2321
_context = context;
2422
_settings = settings;
23+
24+
((DbContext)context).ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
2525
}
2626

2727
// GET api/v1/[controller]/items/[?pageSize=3&pageIndex=10]
@@ -30,7 +30,7 @@ public CatalogController(CatalogContext context, IOptions<Settings> settings)
3030
public async Task<IActionResult> Items(int pageSize = 10, int pageIndex = 0)
3131
{
3232
var totalItems = await _context.CatalogItems
33-
.LongCountAsync();
33+
.LongCountAsync();
3434

3535
var itemsOnPage = await _context.CatalogItems
3636
.OrderBy(c=>c.Name)

src/Services/Catalog/Catalog.API/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM microsoft/aspnetcore:1.0.1
1+
FROM microsoft/aspnetcore:1.1
22
WORKDIR /app
33
EXPOSE 80
44
COPY . /app

src/Services/Catalog/Catalog.API/Startup.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public Startup(IHostingEnvironment env)
3838

3939
public void ConfigureServices(IServiceCollection services)
4040
{
41-
services.AddSingleton<IConfiguration>(Configuration);
42-
4341
services.AddDbContext<CatalogContext>(c =>
4442
{
4543
c.UseSqlServer(Configuration["ConnectionString"]);
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,41 @@
11
{
2+
"buildOptions": {
3+
"emitEntryPoint": true,
4+
"preserveCompilationContext": true,
5+
"debugType": "portable"
6+
},
27
"dependencies": {
38
"Microsoft.NETCore.App": {
4-
"version": "1.0.1",
9+
"version": "1.1.0",
510
"type": "platform"
611
},
7-
"Microsoft.AspNetCore.Mvc": "1.0.1",
8-
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
9-
"Microsoft.AspNetCore.Diagnostics.Abstractions": "1.0.0",
10-
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
11-
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
12-
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
13-
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
14-
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
15-
"Microsoft.Extensions.Configuration.Json": "1.0.0",
16-
"Microsoft.Extensions.Logging": "1.0.0",
17-
"Microsoft.Extensions.Logging.Console": "1.0.0",
18-
"Microsoft.Extensions.Logging.Debug": "1.0.0",
19-
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
20-
"Microsoft.EntityFrameworkCore": "1.0.1",
21-
"Microsoft.EntityFrameworkCore.Relational": "1.0.1",
22-
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
23-
"Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final",
12+
"Microsoft.AspNetCore.Mvc": "1.1.0",
13+
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
14+
"Microsoft.AspNetCore.Diagnostics.Abstractions": "1.1.0",
15+
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
16+
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
17+
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
18+
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
19+
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
20+
"Microsoft.Extensions.Configuration.Json": "1.1.0",
21+
"Microsoft.Extensions.Logging": "1.1.0",
22+
"Microsoft.Extensions.Logging.Console": "1.1.0",
23+
"Microsoft.Extensions.Logging.Debug": "1.1.0",
24+
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
25+
"Microsoft.EntityFrameworkCore": "1.1.0",
26+
"Microsoft.EntityFrameworkCore.Relational": "1.1.0",
27+
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
28+
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
2429
"Swashbuckle": "6.0.0-beta902"
2530
},
26-
"tools": {
27-
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
28-
},
2931
"frameworks": {
30-
"netcoreapp1.0": {
32+
"netcoreapp1.1": {
3133
"imports": [
3234
"dotnet5.6",
3335
"portable-net45+win8"
3436
]
3537
}
3638
},
37-
"buildOptions": {
38-
"emitEntryPoint": true,
39-
"preserveCompilationContext": true,
40-
"debugType": "portable"
41-
},
42-
"runtimeOptions": {
43-
"configProperties": {
44-
"System.GC.Server": true
45-
}
46-
},
4739
"publishOptions": {
4840
"include": [
4941
"wwwroot",
@@ -56,6 +48,14 @@
5648
"Dockerfile"
5749
]
5850
},
51+
"runtimeOptions": {
52+
"configProperties": {
53+
"System.GC.Server": true
54+
}
55+
},
5956
"scripts": {},
57+
"tools": {
58+
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"
59+
},
6060
"userSecretsId": "aspnet-Catalog.API-20161122013618"
6161
}

0 commit comments

Comments
 (0)