Esempio n. 1
0
        public TagGenerator(TagProfileLibrary library, IElementNamingConvention namingConvention, IServiceLocator services)
        {
            ElementPrefix = string.Empty;

            _library          = library;
            _namingConvention = namingConvention;
            _services         = services;

            _profile = _library.DefaultProfile;
        }
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            var library = new TagProfileLibrary();

            _conventions.Each(library.ImportRegistry);

            library.ImportRegistry(new DefaultHtmlConventions());
            library.Seal();

            _container.Register(typeof(TagProfileLibrary), ObjectDef.ForValue(library));
        }
        public AspNetMvcFubuRegistry(params HtmlConventionRegistry[] registries)
        {
            var tagpl = new TagProfileLibrary();
            registries.Each(tagpl.ImportRegistry);
            tagpl.ImportRegistry(new DefaultAspNetMvcHtmlConventions());

            For<ITypeResolver>().Use<TypeResolver>();
            For<ITypeResolverStrategy>().Use<TypeResolver.DefaultStrategy>();
            For<IElementNamingConvention>().Use<AspNetMvcElementNamingConvention>();
            For<TagProfileLibrary>().Use(tagpl);
            For(typeof(ITagGenerator<>)).Use(typeof(TagGenerator<>));
            For<IServiceLocator>().Use(() => ServiceLocator.Current);
        }
        private void registerHtmlConventions(BehaviorGraph graph)
        {
            var library = new TagProfileLibrary();

            graph.Services.FindAllValues<HtmlConventionRegistry>()
                .Each(library.ImportRegistry);

            library.ImportRegistry(new DefaultHtmlConventions());

            library.Seal();

            graph.Services.ClearAll<HtmlConventionRegistry>();
            graph.Services.ReplaceService(library);
            graph.Services.SetServiceIfNone(typeof(ITagGenerator<>), typeof(TagGenerator<>));
            graph.Services.SetServiceIfNone<IElementNamingConvention, DefaultElementNamingConvention>();
        }
 public Html5Activator(TagProfileLibrary profileLibrary)
 {
     _profileLibrary = profileLibrary;
 }