static Resolver() { // A example for registration of resolvers! DynamicResolver.Register <Resolver>("a", typeof(SomeObject)); }
public static void RegisterExtension(string name, Type type) { DynamicResolver.Register <ExtensionsResolverTag>(name, type); }
static Resolver() { // A example for registration of resolvers DynamicResolver.Register <Resolver>("b", typeof(int)); }
public void PassTest() { Type ty; Assert.False(DynamicResolver.Find <Tag>("a", out ty)); DynamicResolver.Register <Tag>("a", typeof(int)); DynamicResolver.Register <Tag>("b", typeof(string)); Assert.True(DynamicResolver.Find <Tag>("a", out ty)); Assert.True(DynamicResolver.Find <Tag>("b", out ty)); Assert.False(DynamicResolver.Find <Tag>("c", out ty)); DynamicResolver.DeRegister <Tag>("b"); Assert.True(DynamicResolver.Find <Tag>("a", out ty)); Assert.False(DynamicResolver.Find <Tag>("b", out ty)); // "b" is unregisterd DynamicResolver.DeRegister <Tag>(); Assert.False(DynamicResolver.Find <Tag>("a", out ty)); // All keys for Tag are unregisterd }