コード例 #1
0
        public static IApplicationBuilder UseDynamicScripts(this IApplicationBuilder builder)
        {
            DynamicScriptRegistration.Initialize(ExtensibilityHelper.SelfAssemblies);
            LookupScriptRegistration.RegisterLookupScripts();
            FormScriptRegistration.RegisterFormScripts();
            ColumnsScriptRegistration.RegisterColumnsScripts();

            var contentPath = builder.ApplicationServices.GetService <IHostingEnvironment>().ContentRootPath;

            new TemplateScriptRegistrar()
            .Initialize(new[]
            {
                System.IO.Path.Combine(contentPath, "Views/Templates"),
                System.IO.Path.Combine(contentPath, "Modules")
            }, watchForChanges: true);

            ScriptFileWatcher.WatchForChanges();
            CssFileWatcher.WatchForChanges();

            return(builder.UseMiddleware <DynamicScriptMiddleware>());
        }
コード例 #2
0
        public static IServiceProvider UseDynamicScriptTypes(this IServiceProvider serviceProvider)
        {
            var scriptManager    = serviceProvider.GetRequiredService <IDynamicScriptManager>();
            var propertyProvider = serviceProvider.GetRequiredService <IPropertyItemProvider>();
            var typeSource       = serviceProvider.GetRequiredService <ITypeSource>();

            DataScriptRegistration.RegisterDataScripts(scriptManager,
                                                       typeSource, serviceProvider);

            LookupScriptRegistration.RegisterLookupScripts(scriptManager,
                                                           typeSource, serviceProvider);

            DistinctValuesRegistration.RegisterDistinctValueScripts(scriptManager,
                                                                    typeSource, serviceProvider);

            ColumnsScriptRegistration.RegisterColumnsScripts(scriptManager,
                                                             typeSource, propertyProvider, serviceProvider);

            FormScriptRegistration.RegisterFormScripts(scriptManager,
                                                       typeSource, propertyProvider, serviceProvider);

            return(serviceProvider);
        }