Пример #1
0
        public static void UseCompositeC1ContribScheduledTasks(this IAppBuilder app, Action <ScheduledTasksConfiguration> configurationCallback)
        {
            var options = new ScheduledTasksConfiguration();

            configurationCallback?.Invoke(options);

            var configuration = GlobalConfiguration.Configuration;

            configuration.UseActivator(new C1CMSContainerJobActivator());
            configuration.UseLogProvider(new C1LogProvider());
            configuration.UseStorage(options.JobStorage);

            var backgroundProcesses = CompositionContainerFacade.GetExportedValues <IBackgroundProcess>().ToArray();

            if (options.ServerOptions != null)
            {
                app.UseHangfireServer(options.ServerOptions, backgroundProcesses);
            }
            else
            {
                app.UseHangfireServer(backgroundProcesses);
            }

            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                AppPath       = null,
                Authorization = new[] { new CompositeC1AuthorizationFilter() }
            });

            ScheduledTasksSection.EnsureJobsFromConfig();

            UrlToEntityTokenFacade.Register(new UrlToEntityTokenMapper());
        }
        static ModelsFacade()
        {
            Providers = CompositionContainerFacade.GetExportedValues <IModelsProvider>().ToList();

            if (!C1Directory.Exists(RootPath))
            {
                C1Directory.CreateDirectory(RootPath);
            }
        }
Пример #3
0
        private static IEnumerable <Type> GetFormTypes()
        {
            return(CompositionContainerFacade.GetExportedTypes <IPOCOForm>(b =>
            {
                var partBuilder = b.ForTypesMatching(t => t.IsClass && !t.IsAbstract && typeof(IPOCOForm).IsAssignableFrom(t));

                partBuilder.Export <IPOCOForm>();
            }).Select(t => t.UnderlyingSystemType));
        }
Пример #4
0
        public static Dictionary <string, string> GetValidatorTypes()
        {
            var formValidationAttributeType = typeof(FormValidationAttribute);

            var types = CompositionContainerFacade.GetExportedTypes <FormValidationAttribute>(b =>
                                                                                              b.ForTypesMatching(t => t != formValidationAttributeType &&
                                                                                                                 formValidationAttributeType.IsAssignableFrom(t) &&
                                                                                                                 t.GetConstructor(Type.EmptyTypes) != null)
                                                                                              .Export <FormValidationAttribute>());

            return(types.ToDictionary(t => t.AssemblyQualifiedName, t => t.NameWithoutTrailingAttribute()));
        }
Пример #5
0
 static Form()
 {
     ValueMappers = CompositionContainerFacade.GetExportedValues <IValueMapper>().ToDictionary(m => m.ValueMapperFor);
 }