-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Switch from Unity Container to DryIOC
This commit switches the dependency injection container in the YumeChan.ConsoleRunner project from Unity Container to DryIOC. The following changes were made: - Removed references to Unity and related namespaces - Added references to DryIoc and DryIoc.Microsoft.DependencyInjection - Updated the CreateHostBuilder method to use DryIocServiceProviderFactory instead of UseUnityServiceProvider - Updated the ConfigureServices method in Program.cs to use IServiceCollection instead of IUnityContainer - Replaced calls to Resolve<Microsoft.Extensions.Logging.ILogger> with GetRequiredService<Microsoft.Extensions.Logging.ILogger> - Updated YumeCore class constructor parameter type from IUnityContainer to IContainer - Removed unused using statements
- Loading branch information
1 parent
e0e9edf
commit ac6376f
Showing
19 changed files
with
58 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/YumeChan.NetRunner.Plugins/Infrastructure/Swagger/PluginNamespaceDocumentFilter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/YumeChan.NetRunner.Plugins/Infrastructure/Swagger/SwaggerDocumentEnumerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
src/YumeChan.NetRunner/Infrastructure/Blazor/ComponentActivator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using System; | ||
using Unity; | ||
using DryIoc; | ||
|
||
namespace YumeChan.NetRunner.Infrastructure.Blazor | ||
{ | ||
public sealed class ComponentActivator : IComponentActivator | ||
{ | ||
private readonly IUnityContainer container; | ||
private readonly IContainer _container; | ||
|
||
public ComponentActivator(IUnityContainer container) | ||
public ComponentActivator(IContainer container) | ||
{ | ||
this.container = container; | ||
this._container = container; | ||
} | ||
|
||
public IComponent CreateInstance(Type type) | ||
{ | ||
object component = container.Resolve(type) ?? Activator.CreateInstance(type); | ||
return (IComponent)component; | ||
object component = _container.Resolve(type, IfUnresolved.ReturnDefaultIfNotRegistered) ?? Activator.CreateInstance(type); | ||
return (IComponent)component ?? throw new InvalidOperationException($"Cannot create an instance of {type}."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
src/YumeChan.NetRunner/Services/Authentication/WebAppClaims.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.