public RazorMachine( Type baseType = null, string rootOperatorPath = null, RazorCodeLanguage language = null, string defaultExtension = null, string autoIncludeName = null, string sharedLocation = null, bool?includeGeneratedSourceCode = null, bool?htmlEncode = null, IEnumerable <string> references = null, IEnumerable <string> namespaces = null, IEnumerable <Func <IContentProvider> > contentProviders = null, bool replaceReferences = false, bool replaceNamespaces = false, bool replaceContentProviders = false ) { Context = new RazorContext(new RazorConfig().InitializeIfSet( baseType, rootOperatorPath, language, defaultExtension, autoIncludeName, sharedLocation, includeGeneratedSourceCode, htmlEncode, references, namespaces, contentProviders, replaceReferences, replaceNamespaces, replaceContentProviders )); }
public RazorMachine(string xmlContentOrFileName) { if (xmlContentOrFileName == null) // default initialization (from app.config or else default settings) Context = new RazorContext(new RazorConfig().Initializer.TryInitializeFromConfig().AsReadOnly()); else if (xmlContentOrFileName.IsFileName()) // initialization by xml configuration file Context = new RazorContext(new RazorConfig().Initializer.InitializeByXmlFileName(xmlContentOrFileName).AsReadOnly()); else if (xmlContentOrFileName.IsXmlContent()) // initialization by literal xml configuration string Context = new RazorContext(new RazorConfig().Initializer.InitializeByXmlContent(xmlContentOrFileName).AsReadOnly()); else throw new ArgumentException("Argument must be either an existing file name or literal xml content", "xmlContentOrFileName"); }
protected virtual void Dispose(bool disposing) { if (!disposing) { return; } var context = Context; Context = null; if (context != null) { context.Dispose(); } }
public RazorMachine(string xmlContentOrFileName) { if (xmlContentOrFileName == null) { // default initialization (from app.config or else default settings) Context = new RazorContext(new RazorConfig().Initializer.TryInitializeFromConfig().AsReadOnly()); } else if (xmlContentOrFileName.IsFileName()) { // initialization by xml configuration file Context = new RazorContext(new RazorConfig().Initializer.InitializeByXmlFileName(xmlContentOrFileName).AsReadOnly()); } else if (xmlContentOrFileName.IsXmlContent()) { // initialization by literal xml configuration string Context = new RazorContext(new RazorConfig().Initializer.InitializeByXmlContent(xmlContentOrFileName).AsReadOnly()); } else { throw new ArgumentException("Argument must be either an existing file name or literal xml content", "xmlContentOrFileName"); } }
public RazorMachine(RazorConfig config) { Context = new RazorContext(config ?? new RazorConfig().Initializer.TryInitializeFromConfig().AsReadOnly()); }
ITemplateController ITemplateController.SetContext(RazorContext context) { RazorContext = context; OnContextSet(); return(this); }
ITemplateInternal ITemplateInternal.SetContext(RazorContext context) { RazorContext = context; OnContextSet(); return(this); }
public RazorMachine( Type baseType = null, string rootOperatorPath = null, RazorCodeLanguage language = null, string defaultExtension = null, string autoIncludeNameWithoutExtension = null, string sharedLocation = null, bool? includeGeneratedSourceCode = null, bool? htmlEncode = null, IEnumerable<string> references = null, IEnumerable<string> namespaces = null, IEnumerable<Func<IContentProvider>> contentProviders = null, bool replaceReferences = false, bool replaceNamespaces = false, bool replaceContentProviders = false ) { Context = new RazorContext(new RazorConfig() .Initializer .TryInitializeFromConfig() .InitializeByValues( baseType, rootOperatorPath, language, defaultExtension, autoIncludeNameWithoutExtension, sharedLocation, includeGeneratedSourceCode, htmlEncode, references, namespaces, contentProviders, replaceReferences, replaceNamespaces, replaceContentProviders ) .AsReadOnly() ); }
public RazorMachine(RazorConfig config) { Context = new RazorContext(config); }
public RazorMachine() { Context = new RazorContext(new RazorConfig().InitializeDefault()); }