Skip to content

.NET Core 2.2 -> 3.0 #597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
24a2ef3
merge: merge into correct email:
wisepotato Oct 23, 2019
adf845b
Merge branch 'feat/upgrade-2.2' into feat/upgrade-2.2-real
wisepotato Oct 23, 2019
4124aa9
feat: upgrade to 2.2
wisepotato Oct 23, 2019
fb6aa66
chore: merge fixes
wisepotato Oct 23, 2019
17f0c8c
chore: spacing fix
wisepotato Oct 23, 2019
10ea6cb
chore: revert silencing error
wisepotato Oct 23, 2019
0a4e322
chore: small spacing fix
wisepotato Oct 23, 2019
9697449
chore: remove unneeeded dependencies
wisepotato Oct 23, 2019
931c97c
chore: fix framework dependencies
wisepotato Oct 23, 2019
dd37d8e
chore: updates
wisepotato Oct 23, 2019
aaa7655
merge: merge from dev-v4
wisepotato Oct 23, 2019
13bfdeb
chore: test fixes
wisepotato Oct 23, 2019
5b10565
chore: start integration tests
wisepotato Oct 23, 2019
487728e
chore: cleanup name of dertest
wisepotato Oct 23, 2019
80ea141
chore: start of getRepostory
wisepotato Oct 23, 2019
754e2e3
chore: upgrade testsdk version + xunit version
wisepotato Oct 23, 2019
19349ae
feat: use template in version control of packages in integrationTests
wisepotato Oct 23, 2019
7617445
feat: unit test assemblyinfo add, port old test to integration (attri…
wisepotato Oct 23, 2019
bc5c1df
docs: add version compatibility
wisepotato Oct 24, 2019
70dd35d
chore: add asterisk for version number
wisepotato Oct 24, 2019
9f11631
feat: port defaultentityrepositorytests to integration tests
wisepotato Oct 24, 2019
67dd3eb
chore: should add logging, done.
wisepotato Oct 24, 2019
15a9402
tests: bad response from tests
wisepotato Oct 24, 2019
153f9cb
chore: fixes for lang version and making ifs more noticable
wisepotato Oct 24, 2019
9e6c36b
fix: fix routing issue with upgrade to enableendpointrouting
wisepotato Oct 24, 2019
bf72324
chore: HostEnvironment -> IWebHostEnvironment
wisepotato Oct 24, 2019
07840c4
chore: act -> Act, assert -> Assert, arrange -> Arrange
wisepotato Oct 24, 2019
9ee71f5
chore: fix tests
wisepotato Oct 24, 2019
9000421
chore: re-add unit test for defaultentityrepository for test IAsyncQu…
wisepotato Oct 24, 2019
2843111
refactor: make if statements more conscise
wisepotato Oct 24, 2019
d6f763f
chore: final stretch
wisepotato Oct 24, 2019
98b1119
tests: revert for good tests
wisepotato Oct 24, 2019
cd7e19c
Revert "tests: revert for good tests"
maurei Oct 29, 2019
90ebfca
Revert "chore: final stretch"
maurei Oct 29, 2019
5f7d330
fix: client generated id tests
maurei Oct 29, 2019
f149bc9
fix: create data tests with workaround for efcore 3.0 bug
maurei Oct 29, 2019
f8e9523
refactor: DetachRelationships usage of is operator
maurei Oct 29, 2019
9ff0709
fix: move MetaStartup to other assembly as .net core 3 bug workaround
maurei Oct 29, 2019
9b2ecdf
fix: UpdatingRelationshipTests locally evaluated queries error
maurei Oct 29, 2019
57c5da1
feat: reintroduced generic processor (RepositoryRelationshipUpdateHel…
maurei Oct 29, 2019
7faa500
feat: full sql support for UpdateRelationshipsAsync using expression …
maurei Oct 29, 2019
73f43e9
fix: DeletingDataTest
maurei Oct 29, 2019
fe67998
fix: paging test
maurei Oct 29, 2019
82005ec
fix: paging unit tests
maurei Oct 29, 2019
4a3296e
chore: remove RE-split models, duplicate models to NoEntityFrameworkE…
maurei Oct 29, 2019
e83abfd
fix: NoEntityFrameworkExample tests fixed by workaround assembly problem
maurei Oct 29, 2019
a81b6ac
fix: connection string e2e test projects
maurei Oct 29, 2019
518e4d0
chore: minor cleanup
maurei Oct 29, 2019
7845250
chore: minor cleanup
maurei Oct 29, 2019
6e8ddf4
chore: cleanup
maurei Oct 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<Project>

<PropertyGroup>
<NetCoreAppVersion>netcoreapp2.2</NetCoreAppVersion>
<NetStandardVersion>netstandard2.0</NetStandardVersion>
<AspNetCoreVersion>2.2.*</AspNetCoreVersion>
<MicrosoftLoggingVersion>2.2.*</MicrosoftLoggingVersion>
<MicrosoftConfigurationVersion>2.2.*</MicrosoftConfigurationVersion>
<MicrosoftOptionsVersion>2.2.*</MicrosoftOptionsVersion>
<EFCoreVersion>2.2.*</EFCoreVersion>
<EFCoreToolsVersion>2.2.*</EFCoreToolsVersion>
<NpgsqlVersion>4.0.0</NpgsqlVersion>
<NpgsqlPostgreSQLVersion>2.1.0</NpgsqlPostgreSQLVersion>
<NetCoreAppVersion>netcoreapp3.0</NetCoreAppVersion>
<NetStandardVersion>netstandard2.1</NetStandardVersion>
<AspNetCoreVersion>3.*</AspNetCoreVersion>
<MicrosoftLoggingVersion>3.*</MicrosoftLoggingVersion>
<MicrosoftConfigurationVersion>3.*</MicrosoftConfigurationVersion>
<MicrosoftOptionsVersion>3.*</MicrosoftOptionsVersion>
<EFCoreVersion>3.*</EFCoreVersion>
<EFCoreToolsVersion>3.*</EFCoreToolsVersion>
<NpgsqlVersion>4.1.1</NpgsqlVersion>
<NpgsqlPostgreSQLVersion>3.0.1</NpgsqlPostgreSQLVersion>
<TuplesVersion>4.5.0</TuplesVersion>
</PropertyGroup>

<!-- Test Project Dependencies -->
<PropertyGroup>
<TestSdkVersion>15.7.2</TestSdkVersion>
<XUnitVersion>2.3.1</XUnitVersion>
<BogusVersion>22.1.2</BogusVersion>
<MoqVersion>4.8.3</MoqVersion>
<TestSdkVersion>16.3.0</TestSdkVersion>
<XUnitVersion>2.4.1</XUnitVersion>
<BogusVersion>28.4.1</BogusVersion>
<MoqVersion>4.13.1</MoqVersion>
</PropertyGroup>
</Project>
15 changes: 15 additions & 0 deletions JsonApiDotnetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore", "src\Js
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GettingStarted", "src\Examples\GettingStarted\GettingStarted.csproj", "{067FFD7A-C66B-473D-8471-37F5C95DF61C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests", "test\IntegrationTests\IntegrationTests.csproj", "{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -158,6 +160,18 @@ Global
{067FFD7A-C66B-473D-8471-37F5C95DF61C}.Release|x64.Build.0 = Release|Any CPU
{067FFD7A-C66B-473D-8471-37F5C95DF61C}.Release|x86.ActiveCfg = Release|Any CPU
{067FFD7A-C66B-473D-8471-37F5C95DF61C}.Release|x86.Build.0 = Release|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x64.ActiveCfg = Debug|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x64.Build.0 = Debug|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x86.ActiveCfg = Debug|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x86.Build.0 = Debug|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|Any CPU.Build.0 = Release|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x64.ActiveCfg = Release|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x64.Build.0 = Release|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x86.ActiveCfg = Release|Any CPU
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -173,6 +187,7 @@ Global
{789085E1-048F-4996-B600-791B9CA3A663} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
{8BCFF95F-4850-427C-AEDB-B5B4F62B2C7B} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
{21D27239-138D-4604-8E49-DCBE41BCE4C8} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2421882-8F0A-4905-928F-B550B192F9A4}
Expand Down
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@

A framework for building [json:api](http://jsonapi.org/) compliant web APIs. The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features such as sorting, filtering and pagination. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection making extensibility incredibly easy.



## Compatibility

A lot of changes were introduced in v4.0.0, the following chart should help you with compatibility issues between .NET Core versions

| .NET Core Version | JADNC Version |
| ----------------- | ------------- |
| 2.0 - 2.2 | v3.* |
| 3.* | v4.* |



## Getting Started

These are some steps you can take to help you understand what this project is and how you can use it:
Expand Down Expand Up @@ -53,10 +66,12 @@ public class Article : Identifiable
```csharp
public class ArticlesController : JsonApiController<Article>
{
public ArticlesController(
IJsonApiContext jsonApiContext,
IResourceService<Article> resourceService)
: base(jsonApiContext, resourceService) { }
public ArticlesController(
IJsonApiOptions jsonApiOptions,
IResourceService<Article> resourceService,
ILoggerFactory loggerFactory)
: base(jsonApiOptions, resourceService, loggerFactory)
{ }
}
```

Expand All @@ -79,19 +94,18 @@ public class Startup

### Development

Restore all nuget packages with:
Restore all NuGet packages with:

```bash
dotnet restore
```

#### Testing

Running tests locally requires access to a postgresql database.
If you have docker installed, this can be propped up via:
Running tests locally requires access to a PostgreSQL database. If you have docker installed, this can be propped up via:

```bash
docker run --rm --name jsonapi-dotnet-core-testing -e POSTGRES_DB=JsonApiDotNetCoreExample -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres
docker run --rm --name jsonapi-dotnet-core-testing -e POSTGRES_DB=JsonApiDotNetCoreExample -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres
```

And then to run the tests:
Expand Down
3 changes: 1 addition & 2 deletions src/Examples/GettingStarted/GettingStarted.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,7 +14,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EFCoreVersion)" />
</ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions src/Examples/GettingStarted/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
Expand All @@ -21,11 +21,10 @@ public void ConfigureServices(IServiceCollection services)
discover => discover.AddCurrentAssembly(), mvcBuilder: mvcBuilder);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, SampleDbContext context)
public void Configure(IApplicationBuilder app, SampleDbContext context)
{
context.Database.EnsureDeleted(); // indicies need to be reset
context.Database.EnsureCreated();

app.UseJsonApi();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="$(EFCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="$(EFCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftConfigurationVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Dictionary<string, object> GetMeta()
{
return new Dictionary<string, object> {
{ "copyright", "Copyright 2015 Example Corp." },
{ "authors", new string[] { "Jared Nance", "Maurits Moeys" } }
{ "authors", new string[] { "Jared Nance", "Maurits Moeys", "Harro van der Kroft" } }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because why not

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really appreciate your work. Thank you all.

};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ private IQueryable<User> FirstCharacterFilter(IQueryable<User> users, FilterQuer
{
switch (filterQuery.Operation)
{
// need to cast to list first because getting the first
// char in a string is apparently not something LINQ can translate
// to a query.
case "lt":
return users.Where(u => u.Username[0] < filterQuery.Value[0]);
return users.ToList().Where(u => u.Username.First() < filterQuery.Value[0]).AsQueryable();
default:
return users.Where(u => u.Username[0] == filterQuery.Value[0]);
return users.ToList().Where(u => u.Username.First() == filterQuery.Value[0]).AsQueryable();
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/Examples/JsonApiDotNetCoreExample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ public class Startup
{
public readonly IConfiguration Config;

public Startup(IHostingEnvironment env)
public Startup(IWebHostEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();

Config = builder.Build();
}

public virtual IServiceProvider ConfigureServices(IServiceCollection services)
public virtual void ConfigureServices(IServiceCollection services)
{
var loggerFactory = new LoggerFactory();
services
Expand All @@ -45,15 +44,15 @@ public virtual IServiceProvider ConfigureServices(IServiceCollection services)
options.LoaDatabaseValues = true;
},
discovery => discovery.AddCurrentAssembly());
return services.BuildServiceProvider();
services.AddClientSerialization();
}

public virtual void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
ILoggerFactory loggerFactory,
AppDbContext context)
{

context.Database.EnsureCreated();
app.UseJsonApi();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftLoggingVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
<PackageReference Include="Npgsql" Version="$(NpgsqlVersion)" />
Expand Down
5 changes: 2 additions & 3 deletions src/Examples/NoEntityFrameworkExample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace NoEntityFrameworkExample
{
public class Startup
{
public Startup(IHostingEnvironment env)
public Startup(IWebHostEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
Expand All @@ -28,7 +28,7 @@ public Startup(IHostingEnvironment env)
public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
public virtual void ConfigureServices(IServiceCollection services)
{
// Add framework services.
var mvcBuilder = services.AddMvcCore();
Expand All @@ -47,7 +47,6 @@ public virtual IServiceProvider ConfigureServices(IServiceCollection services)
services.AddSingleton<IConfiguration>(Configuration);
services.AddSingleton(optionsBuilder.Options);
services.AddScoped<AppDbContext>();
return services.BuildServiceProvider();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down
2 changes: 0 additions & 2 deletions src/Examples/ReportsExample/ReportsExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftLoggingVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
<PackageReference Include="Npgsql" Version="$(NpgsqlVersion)" />
Expand Down
7 changes: 1 addition & 6 deletions src/Examples/ReportsExample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Startup
{
public readonly IConfiguration Config;

public Startup(IHostingEnvironment env)
public Startup(IWebHostEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
Expand All @@ -29,10 +29,5 @@ public virtual void ConfigureServices(IServiceCollection services)
opt => opt.Namespace = "api",
discovery => discovery.AddCurrentAssembly(), mvcBuilder: mvcBuilder);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseMvc();
}
}
}
23 changes: 14 additions & 9 deletions src/JsonApiDotNetCore/Builders/JsonApiApplicationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public JsonApiApplicationBuilder(IServiceCollection services, IMvcCoreBuilder mv
_mvcBuilder = mvcBuilder;
}

internal void ConfigureLogging()
{
_services.AddLogging();
}

/// <summary>
/// Executes the action provided by the user to configure <see cref="JsonApiOptions"/>
/// </summary>
Expand All @@ -62,17 +67,17 @@ public void ConfigureMvc()
_serviceDiscoveryFacade = intermediateProvider.GetRequiredService<IServiceDiscoveryFacade>();
var exceptionFilterProvider = intermediateProvider.GetRequiredService<IJsonApiExceptionFilterProvider>();
var typeMatchFilterProvider = intermediateProvider.GetRequiredService<IJsonApiTypeMatchFilterProvider>();
var routingConvention = intermediateProvider.GetRequiredService<IJsonApiRoutingConvention>();

_mvcBuilder.AddMvcOptions(mvcOptions =>
_mvcBuilder.AddMvcOptions(options =>
{
mvcOptions.Filters.Add(exceptionFilterProvider.Get());
mvcOptions.Filters.Add(typeMatchFilterProvider.Get());
mvcOptions.InputFormatters.Insert(0, new JsonApiInputFormatter());
mvcOptions.OutputFormatters.Insert(0, new JsonApiOutputFormatter());
options.EnableEndpointRouting = true;
options.Filters.Add(exceptionFilterProvider.Get());
options.Filters.Add(typeMatchFilterProvider.Get());
options.InputFormatters.Insert(0, new JsonApiInputFormatter());
options.OutputFormatters.Insert(0, new JsonApiOutputFormatter());
options.Conventions.Insert(0, routingConvention);
});

var routingConvention = intermediateProvider.GetRequiredService<IJsonApiRoutingConvention>();
_mvcBuilder.AddMvcOptions(opt => opt.Conventions.Insert(0, routingConvention));
_services.AddSingleton<IControllerResourceMapping>(routingConvention);
}

Expand Down Expand Up @@ -148,7 +153,7 @@ public void ConfigureServices()
_services.AddSingleton<ILinksConfiguration>(JsonApiOptions);
_services.AddSingleton(resourceGraph);
_services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
_services.AddSingleton<IResourceGraph>(resourceGraph);
_services.AddSingleton(resourceGraph);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a duplicate of line 154?
I have be learning from your work as I watch these commits. Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 118 you have:

var resourceGraph = _resourceGraphBuilder.Build();

This builds the IResourceGraph, seeing as I'm adding an IResourceGraph to the container, it already knows that I'm adding an IResourceGraph so the <IResourceGraph> type generic is not needed. Hope this helps!

Copy link
Contributor

@fdlane fdlane Oct 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fast response....and your code is very helpful.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh, good catch. I will remove that tomorrow. The double singleton is not needed :)

_services.AddSingleton<IResourceContextProvider>(resourceGraph);
_services.AddScoped<ICurrentRequest, CurrentRequest>();
_services.AddScoped<IScopedServiceProvider, RequestScopedServiceProvider>();
Expand Down
Loading