Skip to content

Commit

Permalink
- Resharper cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RonSijm committed Dec 16, 2023
1 parent 872fc69 commit d082853
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 349 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace RonSijm.Demo.Blazyload.WeatherLib4.Component.Properties;

// ReSharper disable once UnusedType.Global
public class BlazyBootstrap
{
// ReSharper disable once UnusedMember.Global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull.Properties;

// ReSharper disable once UnusedType.Global
public class BlazyBootstrap : IBlazyBootstrap
{
public Task<IEnumerable<ServiceDescriptor>> Bootstrap()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace RonSijm.Demo.Blazyload.WeatherLib1.Properties;

// ReSharper disable once UnusedType.Global
public class BlazyBootstrap : IBlazyBootstrap
{
public Task<IEnumerable<ServiceDescriptor>> Bootstrap()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
namespace RonSijm.Demo.Blazyload.WeatherLib3;

// ReSharper disable once UnusedType.Global
public class CustomRegistrationClass
#if DEBUG
: RonSijm.Blazyload.Library.Features.Consumer.IBlazyBootstrap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
// ReSharper disable global UnusedMember.Global

using Microsoft.Extensions.DependencyInjection;

namespace RonSijm.Blazyload.Library.Features.Consumer;

Expand Down
1 change: 1 addition & 0 deletions src/RonSijm.Blazyload.Library/Features/Mode/ModeWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public override int GetHashCode()

public T Value { get; private set; }

// ReSharper disable once UnusedMember.Global
internal void SetValue(object value)
{
Value = value as T;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace RonSijm.Blazyload.Library.Features.Mode;

// ReSharper disable once UnusedType.Global
public static class OptionalRegistration
{
public static void RegisterOptional(this List<(Func<Type, bool> Criteria, Func<Type, IServiceProvider, object> Factory)> typeFunctionOverrides)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public static void UseBlazyload(this WebAssemblyHostBuilder builder, Action<Blaz
optionsConfig?.Invoke(options);

// Not registering services here, but in BlazyServiceProviderFactory instead, so that a consumer (like bUnit) will always have the required services registered.
builder.ConfigureContainer(new BlazyServiceProviderFactory(options, builder.Services));
builder.ConfigureContainer(new BlazyServiceProviderFactory(options));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ public class BlazyServiceProviderFactory : IServiceProviderFactory<BlazyBuilder>
{
private readonly BlazyOptions _options;

public BlazyServiceProviderFactory(BlazyOptions options, IServiceCollection serviceCollection)
public BlazyServiceProviderFactory(BlazyOptions options)
{
_options = options;
serviceCollection.AddSingleton<BlazyAssemblyLoader>();
}

public BlazyBuilder CreateBuilder(IServiceCollection services)
{
services.AddSingleton<BlazyAssemblyLoader>();
var container = new BlazyBuilder(services);
return container;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Text.Json.Serialization;
// ReSharper disable global UnusedMember.Global

using System.Text.Json.Serialization;

namespace RonSijm.Blazyload.Features.DIComponents.Models;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Text.Json.Serialization;
// ReSharper disable global UnusedMember.Global

using System.Text.Json.Serialization;

namespace RonSijm.Blazyload.Features.DIComponents.Models;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace RonSijm.Blazyload.Features.Options;
// ReSharper disable global UnusedMember.Global
// ReSharper disable global UnusedType.Global

namespace RonSijm.Blazyload.Features.Options;
public static class BlazyOptionsExtensions
{
public static SettingsForAssembly UseCustomClass(this SettingsForAssembly options, string classPath)
Expand Down
4 changes: 3 additions & 1 deletion src/RonSijm.Blazyload/Features/Options/Models/ResolveMode.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace RonSijm.Blazyload.Features.Options.Models;
// ReSharper disable global UnusedMember.Global

namespace RonSijm.Blazyload.Features.Options.Models;

public enum ResolveMode
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ internal object GetService(Type serviceType, ServiceProviderEngineScope serviceP
OnResolve(serviceType, serviceProviderEngineScope);

var result = realizedService.Invoke(serviceProviderEngineScope);
System.Diagnostics.Debug.Assert(result is null || CallSiteFactory.IsService(serviceType));
//System.Diagnostics.Debug.Assert(result is null || CallSiteFactory.IsService(serviceType));
return result;
}

Expand Down Expand Up @@ -163,11 +163,6 @@ private void ValidateService(ServiceDescriptor descriptor)
return _ => null;
}

internal void ReplaceServiceAccessor(ServiceCallSite callSite, Func<ServiceProviderEngineScope, object> accessor)
{
_realizedServices[callSite.ServiceType] = accessor;
}

internal IServiceScope CreateScope()
{
if (_disposed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ namespace RonSijm.Blazyload.MicrosoftServiceProvider.ServiceLookup
{
internal sealed class CallSiteChain
{
private readonly Dictionary<Type, ChainItemInfo> _callSiteChain;

public CallSiteChain()
{
_callSiteChain = new Dictionary<Type, ChainItemInfo>();
}
private readonly Dictionary<Type, ChainItemInfo> _callSiteChain = new();

public void CheckCircularDependency(Type serviceType)
{
Expand Down Expand Up @@ -69,16 +64,10 @@ private void AppendResolutionPath(StringBuilder builder, Type currentlyResolving
builder.Append(TypeNameHelper.GetTypeDisplayName(currentlyResolving));
}

private readonly struct ChainItemInfo
private readonly struct ChainItemInfo(int order, Type implementationType)
{
public int Order { get; }
public Type ImplementationType { get; }

public ChainItemInfo(int order, Type implementationType)
{
Order = order;
ImplementationType = implementationType;
}
public int Order { get; } = order;
public Type ImplementationType { get; } = implementationType;
}
}
}

0 comments on commit d082853

Please sign in to comment.