Jack Ukleja
Jack Ukleja

Reputation: 13521

Autofac: How to pass parameters when resolving instance using Metadata Lazy

I can get a collection of the plugins by using the following call:

_schemas = _container.Resolve<IEnumerable<Lazy<IPersistedModel,ISchemaVersion>>>();

Depending on the metadata, I want to create a different instance.

I can create an instance by simply accessing the Value property.

The problem is there is no way to pass a parameter when doing it this way.

Can this be done?

Upvotes: 0

Views: 496

Answers (1)

rcaval
rcaval

Reputation: 762

You could configure the resolved instance registering the OnActivating, OnActivate take a look here.

Upvotes: 1

Related Questions