public TestRuntimeTypeSource()
        {
            var namespaceRegistry = CreateNamespaceRegistry();

            var featureProvider = new TypeFeatureProvider(new TypeConverterProvider());

            featureProvider.FillFromAttributes(ScannedAssemblies.AllExportedTypes());
            testTypeRepository = new TestTypeRepository(namespaceRegistry, new TypeFactory(), featureProvider);

            inner = new RuntimeTypeSource(testTypeRepository, namespaceRegistry);
            inner.RegisterPrefix(new PrefixRegistration("", "root"));
            inner.RegisterPrefix(new PrefixRegistration("x", "another"));
        }
Esempio n. 2
0
        public ProtoInstruction NamespacePrefixDeclaration(string prefix, string ns)
        {
            if (PrefixRegistrationMode == PrefixRegistrationMode.Automatic)
            {
                var prefixRegistration = new PrefixRegistration(prefix, ns);
                if (!typeSource.RegisteredPrefixes.Contains(prefixRegistration))
                {
                    typeSource.RegisterPrefix(prefixRegistration);
                }
            }

            return(new ProtoInstruction
            {
                Namespace = ns,
                XamlType = null,
                NodeType = NodeType.PrefixDefinition,
                Prefix = prefix,
            });
        }
 public void RegisterPrefix(PrefixRegistration prefixRegistration)
 {
     inner.RegisterPrefix(prefixRegistration);
 }