Ejemplo n.º 1
0
        public void Configure(FubuRegistry registry)
        {
            registry.Applies
                .ToAllPackageAssemblies()
                .ToThisAssembly();

            registry.Actions
                .IncludeType<AwesomeMenuHandler>()
                .FindWith<RestfulHandlerActionSource>();

            registry.Routes
                .UrlPolicy<AwesomeCreateRoutingConvention>()
                .UrlPolicy<AwesomeEditRoutingConvention>()
                .UrlPolicy<RestfulCreateRoutingConvention>()
                .UrlPolicy<RestfulDeleteRoutingConvention>()
                .UrlPolicy<RestfulIndexRoutingConvention>()
                .UrlPolicy<RestfulPatchRoutingConvention>()
                .UrlPolicy<RestfulFindRoutingConvention>();

            registry.Models
                .BindModelsWith<EntityModelBinder>();

            registry.Output.ToJson.WhenCallMatches(x => x.HandlerType.IsGenericType);

            registry.UseSpark();

            registry.Views
                .TryToAttachWithDefaultConventions()
                .TryToAttachViewsInPackages()
                .ApplyConvention<IndexViewPolicy>()
                .ApplyConvention<CreateViewPolicy>();

            registry.HtmlConvention<AwesomeHtmlConventions>();
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.HtmlConvention(x =>
            {
                x.Displays.Always.BuildBy(req => new HtmlTag("span").Text(req.StringValue()));
                x.Editors.Always.BuildBy(req => new TextboxTag());
                x.DegradeAccessToFields();
            });

            var container = StructureMapBootstrapper.BuildContainer(registry);
            container.Configure(x => x.For<IFieldAccessRule>().Add<TheModelFieldRules>());

            tags = container.GetInstance<ITagGenerator<TheModel>>();
            tags.Model = new TheModel("No", "ReadOnly", "AllRights");
        }