Пример #1
0
        public FubuExampleRegistry()
        {
            IncludeDiagnostics(true);

            Applies
            .ToThisAssembly();
        }
Пример #2
0
        public ConfigureFubuMVC()
        {
            IncludeDiagnostics(true);

            Applies
            .ToThisAssembly();

            Actions
            .IncludeClassesSuffixedWithController();

            Routes
            .HomeIs <HomeIn>()
            .IgnoreControllerNamesEntirely()
            .IgnoreControllerFolderName()
            .RootAtAssemblyNamespace();

            Import <LessExtension>();
            Import <SassExtension>();
            Import <CoffeeExtension>();

            Assets.CombineAllUniqueAssetRequests();

            this.UseSpark();
            Views.TryToAttachWithDefaultConventions();
        }
        public SimpleProjectManagementRegistry()
        {
            // This line turns on the basic diagnostics and request tracing
            IncludeDiagnostics(true);


            Applies.
            ToThisAssembly();

            this.UseSpark();

            ApplyHandlerConventions(typeof(FeaturesMarker));

            // All public methods from concrete classes ending in "Controller"
            // in this assembly are assumed to be action methods
            //Actions.IncludeClassesSuffixedWithController();

            // Policies
            //Routes
            //    .IgnoreControllerNamesEntirely()
            //    .IgnoreMethodSuffix("Html")
            //    .RootAtAssemblyNamespace();

            // Match views to action methods by matching
            // on model type, view name, and namespace
            Views.TryToAttachWithDefaultConventions();

            Routes.HomeIs <GetHandler>(x => x.Execute(new DashboardRequestModel()));
        }
Пример #4
0
        public ScratchpadFubuRegistry()
        {
            IncludeDiagnostics(true);

            Applies
            .ToThisAssembly();

            Actions
            .FindWith <JsonActionSource>();

            this.ApplyEndpointConventions();

            this.UseSpark();

            Policies
            .Add(new ValidationConvention(call => call.HasInput && call.InputType().Name.Contains("Input")));

            Routes
            .HomeIs <DashboardEndpoint>(e => e.Get(new DashboardRequest()));

            Views
            .TryToAttachWithDefaultConventions();

            HtmlConvention <ScratchpadHtmlConventions>();

            Output
            .ToJson
            .WhenCallMatches(call => call.HasOutput && call.OutputType().Name.Contains("Json"));
        }
Пример #5
0
        public AdvBehaviorGuideRegistry()
        {
            IncludeDiagnostics(true);

            Applies.ToThisAssembly();

            Actions
            .IncludeTypesNamed(x => x.EndsWith("Controller"));

            Routes
            .IgnoreControllerNamespaceEntirely();

            Views
            .TryToAttach(x =>
            {
                x.by_ViewModel_and_Namespace_and_MethodName();
                x.by_ViewModel_and_Namespace();
                x.by_ViewModel();
            });

            Policies
            .EnrichCallsWith <DemoBehaviorForSelectActions>(
                call => call.Method.Name == "Home"
                )
            .EnrichCallsWith <DemoBehaviorForSelectActions>(
                call => call.Returns <HomeViewModel>()
                );

            Policies
            .Add <DemoBehaviorPolicy>();


            Routes.HomeIs <HomeInputModel>();
        }
Пример #6
0
        public HelloSparkRegistry()
        {
            IncludeDiagnostics(true);

            Applies
            .ToThisAssembly();

            Actions
            .IncludeClassesSuffixedWithController();

            ApplyHandlerConventions();

            Routes
            .HomeIs <AirRequest>()
            .IgnoreControllerNamespaceEntirely()
            .IgnoreMethodSuffix("Command")
            .IgnoreMethodSuffix("Query")
            .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Command"), "POST")
            .ConstrainToHttpMethod(action => action.Method.Name.StartsWith("Query"), "GET");

            Policies.Add <AntiForgeryPolicy>();

            this.UseSpark();

            Views
            .TryToAttachWithDefaultConventions()
            .TryToAttachViewsInPackages();

            HtmlConvention <SampleHtmlConventions>();

            Services(s => s.ReplaceService <IUrlTemplatePattern, JQueryUrlTemplate>());

            this.Extensions()
            .For <AirViewModel>("extension-placeholder", x => "<p>Rendered from content extension.</p>");
        }
Пример #7
0
        public HelloSparkRegistry()
        {
            IncludeDiagnostics(true);

            Applies
            .ToThisAssembly()
            .ToAllPackageAssemblies();

            Actions
            .IncludeClassesSuffixedWithController();

            Routes
            .HomeIs <AirController>(c => c.TakeABreath())
            .IgnoreControllerNamespaceEntirely()
            .IgnoreMethodSuffix("Command")
            .IgnoreMethodSuffix("Query")
            .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Command"), "POST")
            .ConstrainToHttpMethod(action => action.Method.Name.StartsWith("Query"), "GET");

            Policies.Add <AntiForgeryPolicy>();

            this.UseSpark();
            Views.TryToAttachWithDefaultConventions();

            HtmlConvention <SampleHtmlConventions>();

            Services(s => s.ReplaceService <IUrlTemplatePattern, JQueryUrlTemplate>());
        }
Пример #8
0
        public CustomFubuRegistry(bool diagnostics)
        {
            Applies.ToThisAssembly();

            Actions
            .IncludeTypesNamed(t => t.EndsWith("Python"))
            .IncludeMethods(m => m.Name.Equals("Command"))
            .IncludeMethods(m => m.Name.Equals("Query"));
        }
Пример #9
0
        public ConfigureFubuMVC()
        {
            NServiceBus.Configure
            .With(HttpRuntime.BinDirectory)
            .HygiaMessageConventions()
            .DefineEndpointName("Hygia.API")
            .StructureMapBuilder(ObjectFactory.Container)
            .XmlSerializer()
            .MsmqTransport()
            .DontUseTransactions()
            .UnicastBus()
            .SendOnly();

            ObjectFactory.Configure(c =>
                                    c.Scan(s =>
            {
                s.LookForRegistries();
                s.AssembliesFromApplicationBaseDirectory();
            }));


            this.UseSpark();
            IncludeDiagnostics(true);
            Applies.ToThisAssembly()
            .ToAllPackageAssemblies()
            .ToAssembly("Hygia.Operations.Faults.Api")
            .ToAssembly("Hygia.Operations.Communication.Api")
            .ToAssembly("Hygia.Operations.Communication.Domain")
            .ToAssembly("Hygia.FaultManagement.Api")
            .ToAssembly("Hygia.LogicalMonitoring.Api")
            .ToAssembly("Hygia.Operations.AuditUploads.Api")
            .ToAssembly("Hygia.UserManagement.Api");
            //todo- Better way?

            // All public methods from concrete classes ending in "Controller"
            // in this assembly are assumed to be action methods
            Actions.IncludeClassesSuffixedWithController();
            Routes.HomeIs <HomeController>(c => c.get_home());

            // Policies
            Routes
            .IgnoreControllerNamesEntirely()
            .IgnoreMethodSuffix("Html")
            .RootAtAssemblyNamespace();

            // Match views to action methods by matching
            // on model type, view name, and namespace
            Views.TryToAttachWithDefaultConventions();


            //todo: use scanning instead
            ApplyConvention <PersistenceConvention>();
            ApplyConvention <CommandsToPickUpBehaviourConfiguration>();
            ApplyConvention <AuthorizeByAttributeConvention>();
        }
Пример #10
0
        public SystemMonitoringRegistry()
        {
            IncludeDiagnostics(true);

            Applies.
            ToThisAssembly();

            this.UseSpark();

            ApplyHandlerConventions(typeof(FeaturesMarker));

            Views.TryToAttachWithDefaultConventions();

            Routes.HomeIs <GetHandler>(x => x.Execute(new DashboardRequestModel()));
        }
Пример #11
0
        public DemoWebFubuRegistry()
        {
            IncludeDiagnostics(true);

            Applies.ToThisAssembly();

//            this.UseSpark();
//
//            Views
//                .TryToAttachWithDefaultConventions()
//                .TryToAttachViewsInPackages();


            //awesome config - we have defaults for all of this
            //move into the lamda
//            AwesomeConfiguration.AwesomeEntities = t => t.CanBeCastTo<MyEntity>();
        }
        public ConfigureFubuMVC()
        {
            IncludeDiagnostics(true);

            Applies.ToThisAssembly();

            ApplyHandlerConventions();

            Routes
            .HomeIs <HomeInputModel>()
            .IgnoreControllerNamesEntirely()
            .IgnoreMethodSuffix("Html")
            .RootAtAssemblyNamespace();

            this.UseSpark();

            Views.TryToAttachWithDefaultConventions();
        }
Пример #13
0
        public FUBUPROJECTSHORTNAMERegistry()
        {
            IncludeDiagnostics(true);

            Applies
            .ToThisAssembly();

            Actions
            .IncludeClassesSuffixedWithController();

            Routes
            .IgnoreControllerNamespaceEntirely();

            this.UseSpark();

            Views
            .TryToAttachWithDefaultConventions();
        }
Пример #14
0
        public HelloSparkRegistry()
        {
            IncludeDiagnostics(true);

            Applies
            .ToThisAssembly();

            Actions
            .IncludeClassesSuffixedWithController();

            this.Spark(spark =>
            {
                spark
                .Settings
                .AddViewFolder("/Features/");

                spark
                .Policies
                .Add <HelloSparkJavaScriptViewPolicy>()
                .Add <HelloSparkPolicy>();

                spark
                .Output
                .ToJavaScriptWhen(call => call.HasOutput && call.OutputType().Equals(typeof(JavaScriptResponse)));
            });

            //this.Validation<ValidationRegistry>(validation => validation
            //                                                      .Failures
            //                                                      .IfModelTypeIs<CreateProductInput>()
            //                                                      .TransferTo<CreateProductRequest>());

            Routes
            .UrlPolicy <HelloSparkUrlPolicy>()
            .HomeIs <AirController>(c => c.TakeABreath());

            Output
            .ToJson
            .WhenTheOutputModelIs <JsonResponse>();
        }
        public ChocolateyRegistry()
        {
            IncludeDiagnostics(true);

            Applies.ToThisAssembly();

            Actions.IncludeTypesNamed(x => x.EndsWith("Action"));

            Routes
            .IgnoreNamespaceText("Chocolatey.Web.Actions")
            .IgnoreControllerNamesEntirely()
            .IgnoreClassSuffix("Action")
            .IgnoreMethodsNamed("Execute")
            .IgnoreMethodsNamed("Get").ConstrainToHttpMethod(action => action.Method.Name.Equals("Get"), "GET")
            .IgnoreMethodsNamed("Post").ConstrainToHttpMethod(action => action.Method.Name.Equals("Post"), "POST")
            //.IgnoreMethodsNamed("Delete").ConstrainToHttpMethod(action => action.Method.Name.Equals("Delete"), "DELETE")
            //.IgnoreMethodsNamed("Put").ConstrainToHttpMethod(action => action.Method.Name.Equals("Put"), "PUT")
            ;

            Routes.HomeIs <HomeAction>(x => x.Get(null));

            Views.TryToAttachWithDefaultConventions();
        }
Пример #16
0
        public CodeCampOverflowFubuRegistry()
        {
            IncludeDiagnostics(true);

            Applies.ToThisAssembly();

            Actions.IncludeClassesSuffixedWithController();

            Routes
            .HomeIs <HomeController>(x => x.IndexQuery())
            .IgnoreControllerNamespaceEntirely()
            .IgnoreMethodsNamed("Index")
            .IgnoreMethodSuffix("Command")
            .IgnoreMethodSuffix("Query")
            .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Command"), "POST")
            .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Query"), "GET");

            Views.TryToAttachWithDefaultConventions();

            ApplyConvention <ValidationConvention>();
            ApplyConvention <PersistenceConvention>();

            HtmlConvention <CodeCampOverflowHtmlConventions>();
        }
Пример #17
0
        public CoreRegistry()
        {
            Applies.ToThisAssembly();
            //IncludeDiagnostics(true);

            Actions.IncludeTypesNamed(x => x.EndsWith("Handler"));

            Routes
            .ConstrainToHttpMethod(x => x.Method.Name.EndsWith("Query"), "GET")
            .ConstrainToHttpMethod(x => x.Method.Name.EndsWith("Command"), "POST");

            Routes
            .IgnoreNamespaceText(typeof(CoreRegistry).Namespace)
            .IgnoreNamespaceText("Handlers")
            .IgnoreMethodsNamed("Query")
            .IgnoreMethodsNamed("Command")
            .IgnoreClassSuffix("Handler");

            Routes.HomeIs <HomeHandler>(x => x.Query(new HomeQueryModel()));
            Views.TryToAttachWithDefaultConventions()
            .RegisterActionLessViews(t => t.ViewModelType == typeof(Notification));

            this.UseSpark();

            Policies.ConditionallyWrapBehaviorChainsWith <HandlerAssetConvention>(x => x.HandlerType.Namespace.Contains("Products"));

            Policies.Add(new ProductNotFoundPolicy <EditHandler>(h => h.Query(null)));
            Policies.Add(new ProductNotFoundPolicy <DeleteHandler>(h => h.Query(null)));

            Output.ToJson.WhenCallMatches(x => x.Method.Name.Equals("Data"));

            Import <BasicLocalizationSupport>(x =>
            {
                x.LocalizationStorageIs <InMemoryLocalizationStorage>();
                x.LoadLocalizationWith <LocalizationActivator>();
                x.DefaultCulture = Thread.CurrentThread.CurrentUICulture;
            });


            var validationRulesHtmlConventionActivator = ObjectDef.ForType <ValidationHtmlConvention>();
            var validationRulesHtmlConvention          = new HtmlConventionRegistry();

            validationRulesHtmlConventionActivator.DependencyByValue(validationRulesHtmlConvention);

            Services(cfg =>
            {
                cfg.SetServiceIfNone <IProductService, InMemoryProductService>();
                cfg.SetServiceIfNone(Mapper.Engine);
                cfg.SetServiceIfNone(Mapper.Configuration);
                cfg.SetServiceIfNone <ILocaleCacheFactory, LocaleCacheFactory>();
                cfg.SetServiceIfNone <IValidationDescriptorProvider>(new ValidationDescriptorProvider());
                cfg.AddService <IHtmlValidationConvention, LocalizedNameConvention>();
                cfg.AddService <IHtmlValidationConvention, RequiredHtmlValidationConvention>();
                cfg.AddService <IHtmlValidationConvention, GreaterOrEqualToZeroHtmlValidationConvention>();
                cfg.AddService <IHtmlValidationConvention, MaximumLengthHtmlValidationConvention>();
                cfg.AddService <IFieldValidationSource, AddProductModelValidationSource>();
                cfg.AddService <IActivator, AutoMapperActivator>();
                cfg.AddService <IActivator, ValidationDescriptorProviderFiller>();
                cfg.AddService(typeof(IActivator), validationRulesHtmlConventionActivator);
            });

            HtmlConvention(htmlConventions);
            HtmlConvention(validationRulesHtmlConvention);

            this.Validation(validation =>
            {
                validation.Actions.Include(call => call.HasInput && call.Method.Name.Equals("Command"));
                validation.Failures
                .IfModelIs <EditProductCommandModel>().TransferBy <ValidationDescriptor>();
            });

            Models.BindPropertiesWith <OriginalModelBinder>();
        }
Пример #18
0
        public TestPackage4Registry()
        {
            Applies.ToThisAssembly();

            Actions.IncludeClassesSuffixedWithController();
        }