Fixing other projects to supports latest in container

This commit is contained in:
Eugene Sadovoi 2019-04-20 22:36:02 -04:00
Родитель f78dfd2539
Коммит fbfd084cdb
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -13,8 +13,8 @@ namespace BuildPlanExample
// Note name of the registration! It tells Unity that this policy
// applies to ALL resolutions of the type regardless of requested name.
// In other words it creates 'Built-In' registration similar to Lazy or IEnumerable.
Context.Policies.Set(typeof(IFoo<>), UnityContainer.All, typeof(ResolveDelegateFactory), (ResolveDelegateFactory)FooBuildPlanPolicy.GetResolver);
Context.Policies.Set(typeof(Foo<>), UnityContainer.All, typeof(ResolveDelegateFactory), (ResolveDelegateFactory)FooBuildPlanPolicy.GetResolver); // Optional
Context.Policies.Set(typeof(IFoo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)FooBuildPlanPolicy.GetResolver);
Context.Policies.Set(typeof(Foo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)FooBuildPlanPolicy.GetResolver); // Optional
}
}
}

Просмотреть файл

@ -32,7 +32,7 @@ namespace BuildPlanCreatorExample
.CreateDelegate(typeof(ResolveDelegate<BuilderContext>));
// Register BuildPlan policy with the container to optimize performance
_policies.Set(context.Type, UnityContainer.All, typeof(ResolveDelegate<BuilderContext>), factoryMethod);
_policies.Set(context.Type, typeof(ResolveDelegate<BuilderContext>), factoryMethod);
return factoryMethod;
}

Просмотреть файл

@ -14,8 +14,8 @@ namespace BuildPlanCreatorExample
// applies to ALL resolutions of the type regardless of requested name.
// In other words it creates 'Built-In' registration similar to Lazy or IEnumerable.
var instance = new FooBuildPlanCreatorPolicy(Context.Policies);
Context.Policies.Set(typeof(IFoo<>), UnityContainer.All, typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver);
Context.Policies.Set(typeof(Foo<>), UnityContainer.All, typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver); // Optional
Context.Policies.Set(typeof(IFoo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver);
Context.Policies.Set(typeof(Foo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver); // Optional
}
}
}