You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Lamar;
using Lamar.Microsoft.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = Host.CreateApplicationBuilder()
.UseLamar(
registry =>
{
registry.AddSingleton<A>();
registry.Use<B>().Singleton().For<IB>();
registry.For<C>().Use<C>().Singleton();
registry.Use<D>().Singleton().For<D>();
}
);
var host = builder.Build();
host.Start();
var services = host.Services;
Console.WriteLine(ReferenceEquals(services.GetRequiredService<A>(), services.GetRequiredService<A>()));
Console.WriteLine(ReferenceEquals(services.GetRequiredService<B>(), services.GetRequiredService<B>()));
Console.WriteLine(ReferenceEquals(services.GetRequiredService<C>(), services.GetRequiredService<C>()));
Console.WriteLine(ReferenceEquals(services.GetRequiredService<D>(), services.GetRequiredService<D>())); // StackOverflow
class A
{
}
interface IB
{
}
class B : IB
{
}
class C
{
}
class D
{
}
The text was updated successfully, but these errors were encountered:
@c0nstexpr I think the most likely action here is that the "inverse" expression stuff is ripped out in the next version. It's been buggy in the past. I took that in from a PR , and the original author of that is no longer involved.
@c0nstexpr I think the most likely action here is that the "inverse" expression stuff is ripped out in the next version. It's been buggy in the past. I took that in from a PR , and the original author of that is no longer involved.
I agree, user like me would found such feature is confusing
The text was updated successfully, but these errors were encountered: