Skip to content

RegisterFactory with Interceptors #33

@ArnaudB88

Description

@ArnaudB88

Hi,

Since the InjectionFactory is deprecated, I am trying to use the RegisterFactory method.
I have registrations which use a factory and also have interceptor(s):

Func<IUnityContainer, object> factoryFunc = c => new FileSystemWithWaitAndRetry(
	new FileSystemService(container.Resolve<System.IO.Abstractions.IFileSystem>()),
	container.Resolve<ILogger>());

container.RegisterType<IFileSystemService>(
	createLifetimeManager(),
	new InjectionFactory(factoryFunc),
	new Interceptor<InterfaceInterceptor>(),
	new InterceptionBehavior(new ImpersonationBehavior(sSettings.ImpersonatorDomain, sSettings.ImpersonatorUsername, sSettings.ImpersonatorPassword, container.Resolve<ILogger>())));

(This is a service for filesystem access with a 'wait and retry' decorator. Interception adds impersonation)

How can the RegisterType be rewritten to RegisterFactory and still pass the InterceptionBehaviour?
Is the RegisterFactory method missing some functionality?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions