-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Is there anyway to apply ConcreteTypeDynamicRegistrations to Rules.MicrosoftDependencyInjectionRules? #555
Comments
@caoyanmin using System;
using DryIoc;
public class Program
{
public static void Main()
{
var c = new Container(Rules.MicrosoftDependencyInjectionRules.WithConcreteTypeDynamicRegistrations(reuse: Reuse.Transient));
var o = c.Resolve<OtherService>();
Console.WriteLine(o.Dependency);
}
internal class Dependency
{
}
internal class OtherService
{
public readonly Dependency Dependency;
public OtherService(Dependency dependency) => Dependency = dependency;
}
} |
@dadhi Thank you for your answer!
|
Hmm, ok. Will check Tomorrow. |
@caoyanmin var host = Host.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.AddSingleton<IService, Service>();
})
.UseServiceProviderFactory(new DryIocServiceProviderFactory(container))
.Build(); |
It doesn't work. |
@caoyanmin What .NET version are you targeting and what DryIoc version is in use? |
@dadhi Here is the full demo project. This table show the result when I use different rules:
|
@caoyanmin Hi, thanks for the well-prepared example. |
@caoyanmin Hi, the fix is pushed to the Nuget with DryIoc.Microsoft.DependencyInjection v6.1.1. |
@dadhi Thank you for your help! |
I create the rules follow the code:
var rules = Rules.Default.WithConcreteTypeDynamicRegistrations(reuse: Reuse.Transient).WithMicrosoftDependencyInjectionRules();
or
var rules = Rules.MicrosoftDependencyInjectionRules.WithConcreteTypeDynamicRegistrations(reuse: Reuse.Transient);
but it doesn't work.
The text was updated successfully, but these errors were encountered: