I'm trying to use dynamic DI. I have my configuration:
container.RegisterType<IUserAdditionalData, UserAdditionalDataRepository>(
new HierarchicalLifetimeManager());
container.RegisterType<IPermission, PermissionRepository>(
new HierarchicalLifetimeManager());
config.DependencyResolver = new UnityResolver.UnityResolver(container);
At this point, It's all Ok. But I need to set my class dynamically. I have two class, PermissionRepository and PermissionRepositoryTwo, that implements from IPermission, so I'd like to switch between PermissionRepository and PermissionRepositoryTwo. I've read I can use strategy pattern, someone have any idea how can resolve this?