예제 #1
0
 public ViewContext(ViewEngine viewEngine)
 {
     this._viewEngine    = viewEngine;
     this._configuration = viewEngine.ViewConfiguration;
     this._viewData      = new Dictionary <string, object>();
     this._viewModel     = null;
 }
예제 #2
0
        public ViewEngine(ViewConfiguration viewConfiguration)
        {
            this.ViewConfiguration = viewConfiguration;

            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var catalog         = new AggregateCatalog(assemblyCatalog);

            if (!string.IsNullOrEmpty(viewConfiguration.PluginFolder))
            {
                if (System.IO.Directory.Exists(viewConfiguration.PluginFolder) == false)
                {
                    throw new DirectoryNotFoundException("PluginFolder Not found");
                }
                //var directoryCatalog = new DirectoryCatalog(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, viewConfiguration.PluginFolder));
                var directoryCatalog = new DirectoryCatalog(viewConfiguration.PluginFolder);
                catalog.Catalogs.Add(directoryCatalog);
            }
            //
            foreach (var assembly in viewConfiguration.PluginAssemblies)
            {
                catalog.Catalogs.Add(new AssemblyCatalog(assembly));
            }
            //
            new CompositionContainer(catalog).ComposeParts(this);
            functions = new Functions(ImportedBlockFunctions, ImportedInlineFunctions, ImportedExpressionFunctions, ImportedVariableModifiers);
        }
예제 #3
0
 public ViewContext(ViewEngine viewEngine, object viewModel, IDictionary <string, object> viewData)
 {
     this._viewEngine    = viewEngine;
     this._configuration = viewEngine.ViewConfiguration;
     this._viewData      = viewData;
     this._viewModel     = viewModel;
 }