I am facing an issue when I use Unity to inject a dependency with two partial classes. This is what I have done:
public partial class MyDbContext : IMyDbContext
{
// code
}
public partial class MyDbContext : IMyDbContext
{
// code
}
public interface IMyDbContext
{
// code
}
var container = new UnityContainer();
container.RegisterType<IMyDbContext,
MyDbContext>(new HierarchicalLifetimeManager());
config.DependencyResolver = new UnityResolver(container);
Using the above code, I get an exception about my db is null. But, If I remove one partial class, so I will have only one partial class, all works fine. I would very appreacite if you could you please on this.
EDIT: When I in debug mode, the Unit container GetService method catches an exception ResolutionFailedException.