Skip to content
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

Update to .NET 8 #20

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/Bindicate.Tests/Bindicate.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Bindicate.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

namespace Bindicate.Tests.Generic;

Expand Down Expand Up @@ -45,8 +44,8 @@
using (var scope1 = serviceProvider.CreateScope())
{
var scopedProvider1 = scope1.ServiceProvider;
instance1 = scopedProvider1.GetService<IRepository<Customer>>();

Check warning on line 47 in src/Bindicate.Tests/Generic/GenericInterfaceRegistrationTests.cs

View workflow job for this annotation

GitHub Actions / run_test

Converting null literal or possible null value to non-nullable type.
instance2 = scopedProvider1.GetService<IRepository<Customer>>();

Check warning on line 48 in src/Bindicate.Tests/Generic/GenericInterfaceRegistrationTests.cs

View workflow job for this annotation

GitHub Actions / run_test

Converting null literal or possible null value to non-nullable type.

// Assert that both instances are the same within the same scope
instance1.Should().Be(instance2);
Expand All @@ -56,7 +55,7 @@
using (var scope2 = serviceProvider.CreateScope())
{
var scopedProvider2 = scope2.ServiceProvider;
instance3 = scopedProvider2.GetService<IRepository<Customer>>();

Check warning on line 58 in src/Bindicate.Tests/Generic/GenericInterfaceRegistrationTests.cs

View workflow job for this annotation

GitHub Actions / run_test

Converting null literal or possible null value to non-nullable type.

// Assert that this instance is different from the instances from the first scope
instance3.Should().NotBe(instance1);
Expand Down
1 change: 0 additions & 1 deletion src/Bindicate.Tests/Scoped/AddScopedAttributeTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Bindicate.Attributes;
using Bindicate.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Bindicate.Tests.ScopedTests;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Bindicate.Attributes;
using Bindicate.Configuration;
using Bindicate.Tests.ScopedTests;
using Microsoft.Extensions.DependencyInjection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Bindicate.Attributes;
using Bindicate.Configuration;
using Bindicate.Tests.ScopedTests;
using Microsoft.Extensions.DependencyInjection;

namespace Bindicate.Tests.Transient;

public class AddTransientAttributeTests
Expand Down
6 changes: 3 additions & 3 deletions src/Bindicate/Bindicate.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Title>Bindicate</Title>
<Authors>Tim Maes</Authors>
<Description>Autowiring library. Easily add services to DI container by decorating your service with an attribute</Description>
<Description>Autowiring library. Easily add services to DI container by decorating your services with an attribute</Description>
<PackageProjectUrl>https://www.github.com/Tim-Maes/Bindicate</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://www.github.com/Tim-Maes/Bindicate</RepositoryUrl>
<PackageTags>di, ioc, service, collection, extensions, attribute</PackageTags>
<PackageReleaseNotes>Add support for IOptions</PackageReleaseNotes>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<Version>1.2.1</Version>
<Version>1.3</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/Bindicate/Configuration/AutowiringBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@

public class AutowiringBuilder
{
public IServiceCollection _services { get; }
private IServiceCollection _services { get; }

public Assembly _targetAssembly { get; }
private Assembly _targetAssembly { get; }

public AutowiringBuilder(IServiceCollection services, Assembly targetAssembly)
{
_services = services;
_targetAssembly = targetAssembly;

AddAutowiringForAssembly();
}

Expand Down Expand Up @@ -98,7 +99,7 @@
.GetMethods()
.FirstOrDefault(m => m.Name == "Configure" && m.GetParameters().Length == 2);

var specializedMethod = genericOptionsConfigureMethod.MakeGenericMethod(type);

Check warning on line 102 in src/Bindicate/Configuration/AutowiringBuilder.cs

View workflow job for this annotation

GitHub Actions / create_nuget

Dereference of a possibly null reference.

Check warning on line 102 in src/Bindicate/Configuration/AutowiringBuilder.cs

View workflow job for this annotation

GitHub Actions / run_test

Dereference of a possibly null reference.
specializedMethod.Invoke(null, new object[] { _services, configSection });
}
}
Expand Down
Loading