Ejemplo n.º 1
0
        static ViewFactory()
        {
            var exportedViews = from b in ExportedTypesProvider.GetExportedTypes()
                                where b.Name.EndsWith(viewSuffix) && b.IsSubclassOf(baseViewType)
                                select b;


            foreach (var type in exportedViews)
            {
                RegisterView(type);
            }
        }
Ejemplo n.º 2
0
        static BuilderRouteHandler()
        {
            var exportedBuilders = from b in ExportedTypesProvider.GetExportedTypes()
                                   where b.Name.EndsWith(builderSuffix) && b.IsSubclassOf(baseBuilderType)
                                   select b;

            foreach (var type in exportedBuilders)
            {
                RegisterBuilder(type);
            }

            builderRegistry = builderRegistry.OrderByDescending(bpp => bpp.Priority).ThenByDescending(bpp => bpp.Pattern).ToList();
        }
Ejemplo n.º 3
0
        static BuilderFactory()
        {
            var sw = System.Diagnostics.Stopwatch.StartNew();

            var exportedBuilders = from b in ExportedTypesProvider.GetExportedTypes()
                                   where b.IsSubclassOf(baseBuilderType)
                                   select b;

            foreach (var type in exportedBuilders)
            {
                object[] factoryRegistrationAttributes = type.GetCustomAttributes(typeof(FactoryIdentifierAttribute), false);
                if (factoryRegistrationAttributes.Length > 0)
                {
                    var identifier = ((FactoryIdentifierAttribute)factoryRegistrationAttributes[0]).Identifier;
                    if (String.IsNullOrEmpty(identifier))
                    {
                        identifier = type.Name;
                    }
                    builderRegistry.TryAdd(identifier, type);
                }
            }

            System.Diagnostics.Debug.WriteLine(sw.ElapsedMilliseconds);
        }