Grace
Grace copied to clipboard
Add support for properties dynamic import strategy
Like:
Container = new DependencyInjectionContainer(_ =>
{
_.Behaviors.ConstructorSelection = ConstructorSelectionMethod.Dynamic; // < -- Like that
});
But for property. Locate type with [Import] attribute in sub container doesn't work
interface IDep{}
interface IFoo{}
class Dep : IDep {}
class Foo : IFoo
{
[Import]
public IDep Dep {get;init;}
}
// ----------------------
Container.Configure(_b=>_b.ExportAs<Dep,IDep>());
Container
.CreateChildScope(_b=>_b
.ExportAs<Foo,IFoo>()
.ImportMembers(MembersThat.HaveAttribute<ImportAttribute>())
.Lifestyle.Singleton()
).Locate<Foo>();
Sorry for the late response I've been AFK this past week. I can take a look this evening.
@ipjohnson did you ever get around to this? I am seeing similar behaviour on latest. Thanks for the awesome work!