Esempio n. 1
0
        public static Func <object, string> GetOrCompileTemplate(string viewPath)
        {
            var template = CompiledViews.GetOrAdd(viewPath, view =>
            {
                var compiledView = CompileView(viewPath);
                CompiledViews.TryAdd(viewPath, compiledView);

                return(compiledView);
            });

            //if (template == null)
            //{
            //	template = CompileView(viewPath);
            //	CompiledViews.AddOrUpdate(viewPath, template);
            //}

            return(template);
        }
Esempio n. 2
0
        public static void RegisterArea(Type clientType,
                                        string areaName            = null,
                                        string controllerNamespace = null,
                                        string resourcesNamespace  = null)
        {
            if (areaName == null)
            {
                areaName = clientType.Namespace.AfterLast('.');
            }

            if (areaName.Start(1) == "/")
            {
                throw new SystemException("Invalid start character / in {0}".FormatWith(areaName));
            }

            if (controllerNamespace == null)
            {
                controllerNamespace = clientType.Namespace;
            }

            if (resourcesNamespace == null)
            {
                resourcesNamespace = clientType.Namespace;
            }

            var assembly = clientType.Assembly;

            CompiledViews.RegisterArea(assembly, areaName);
            SignumControllerFactory.RegisterControllersIn(assembly, controllerNamespace, areaName);

            EmbeddedFilesRepository rep = new EmbeddedFilesRepository(assembly, "~/" + areaName + "/", resourcesNamespace);

            if (!rep.IsEmpty)
            {
                FileRepositoryManager.Register(rep);
            }
        }