Fixing other projects to supports latest in container
This commit is contained in:
Родитель
f78dfd2539
Коммит
fbfd084cdb
|
@ -13,8 +13,8 @@ namespace BuildPlanExample
|
||||||
// Note name of the registration! It tells Unity that this policy
|
// Note name of the registration! It tells Unity that this policy
|
||||||
// applies to ALL resolutions of the type regardless of requested name.
|
// applies to ALL resolutions of the type regardless of requested name.
|
||||||
// In other words it creates 'Built-In' registration similar to Lazy or IEnumerable.
|
// 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(IFoo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)FooBuildPlanPolicy.GetResolver);
|
||||||
Context.Policies.Set(typeof(Foo<>), UnityContainer.All, typeof(ResolveDelegateFactory), (ResolveDelegateFactory)FooBuildPlanPolicy.GetResolver); // Optional
|
Context.Policies.Set(typeof(Foo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)FooBuildPlanPolicy.GetResolver); // Optional
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace BuildPlanCreatorExample
|
||||||
.CreateDelegate(typeof(ResolveDelegate<BuilderContext>));
|
.CreateDelegate(typeof(ResolveDelegate<BuilderContext>));
|
||||||
|
|
||||||
// Register BuildPlan policy with the container to optimize performance
|
// 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;
|
return factoryMethod;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ namespace BuildPlanCreatorExample
|
||||||
// applies to ALL resolutions of the type regardless of requested name.
|
// applies to ALL resolutions of the type regardless of requested name.
|
||||||
// In other words it creates 'Built-In' registration similar to Lazy or IEnumerable.
|
// In other words it creates 'Built-In' registration similar to Lazy or IEnumerable.
|
||||||
var instance = new FooBuildPlanCreatorPolicy(Context.Policies);
|
var instance = new FooBuildPlanCreatorPolicy(Context.Policies);
|
||||||
Context.Policies.Set(typeof(IFoo<>), UnityContainer.All, typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver);
|
Context.Policies.Set(typeof(IFoo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver);
|
||||||
Context.Policies.Set(typeof(Foo<>), UnityContainer.All, typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver); // Optional
|
Context.Policies.Set(typeof(Foo<>), typeof(ResolveDelegateFactory), (ResolveDelegateFactory)instance.GetResolver); // Optional
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче