C# Класс GSF.Web.Embedded.EmbeddedResourceProvider

Represents a VirtualPathProvider that allows access to embedded resources.

This provider responds to requests for embedded resources when the virtual path begins with an "@", e.g., http://localhost/@GSF.Web.Model.Scripts.gsf.web.client.js

To use, add the following to the Global.asax.cs Application_Start function: // Add additional virtual path provider to allow access to embedded resources EmbeddedResourceProvider.Register(); Then add the namespace paths to the embedded resources for which you need access to the Web.config <system.webServer> section: <system.webServer> <handlers> <!-- Add embedded resource handler for GSF script resources using slash delimiters --> <add name="EmbeddedResourceHandler-GSFScripts" path="@GSF/Web/Model/Scripts/*" verb="*" type="System.Web.StaticFileHandler" allowPathInfo="true" /> <!-- Add embedded resource handler for GSF view resources using slash delimiters --> <add name="EmbeddedResourceHandler-GSFViews" path="@GSF/Web/Model/Views/*" verb="*" type="System.Web.StaticFileHandler" allowPathInfo="true" /> <!-- Add embedded resource handler for GSF handler resources using slash delimiters --> <add name="EmbeddedResourceHandler-GSFHandlers" path="@GSF/Web/Model/Handlers/*" verb="*" type="System.Web.UI.SimpleHandlerFactory" allowPathInfo="true" /> <!-- Add embedded resource handler for fully qualified type names using dot delimiters (this should be defined last) --> <add name="EmbeddedResourceHandler-FQName" path="@*" verb="*" type="System.Web.StaticFileHandler" allowPathInfo="true" /> </handlers> </system.webServer>

Наследование: System.Web.Hosting.VirtualPathProvider
Показать файл Открыть проект

Открытые методы

Метод Описание
DirectoryExists ( string virtualDir ) : bool

Gets a value that indicates whether a directory exists in the virtual file system.

FileExists ( string virtualPath ) : bool

Gets a value that indicates whether a file exists in the virtual file system.

Any virtual path that begins with an @ symbol is assumed to be an embedded resource where the path represents the namespace hierarchy in either slash or dot notation.

GetCacheDependency ( string virtualPath, IEnumerable virtualPathDependencies, System.DateTime utcStart ) : System.Web.Caching.CacheDependency

Creates a cache dependency based on the specified virtual paths.

GetDirectory ( string virtualDir ) : System.Web.Hosting.VirtualDirectory

Gets a virtual directory from the virtual file system.

GetFile ( string virtualPath ) : System.Web.Hosting.VirtualFile

Gets a file from the virtual file system.

Register ( ) : void

Registers the EmbeddedResourceProvider within a HostingEnvironment.

This function will properly register the EmbeddedResourceProvider even when being run from within a pre-compiled web application.

Приватные методы

Метод Описание
IsEmbeddedResource ( string virtualPath ) : bool
ParseResourceNameFromVirtualPath ( string virtualPath ) : string

Описание методов

DirectoryExists() публичный Метод

Gets a value that indicates whether a directory exists in the virtual file system.
public DirectoryExists ( string virtualDir ) : bool
virtualDir string The path to the virtual directory.
Результат bool

FileExists() публичный Метод

Gets a value that indicates whether a file exists in the virtual file system.
Any virtual path that begins with an @ symbol is assumed to be an embedded resource where the path represents the namespace hierarchy in either slash or dot notation.
public FileExists ( string virtualPath ) : bool
virtualPath string The path to the virtual file.
Результат bool

GetCacheDependency() публичный Метод

Creates a cache dependency based on the specified virtual paths.
public GetCacheDependency ( string virtualPath, IEnumerable virtualPathDependencies, System.DateTime utcStart ) : System.Web.Caching.CacheDependency
virtualPath string The path to the primary virtual resource.
virtualPathDependencies IEnumerable An array of paths to other resources required by the primary virtual resource.
utcStart System.DateTime The UTC time at which the virtual resources were read.
Результат System.Web.Caching.CacheDependency

GetDirectory() публичный Метод

Gets a virtual directory from the virtual file system.
public GetDirectory ( string virtualDir ) : System.Web.Hosting.VirtualDirectory
virtualDir string The path to the virtual directory.
Результат System.Web.Hosting.VirtualDirectory

GetFile() публичный Метод

Gets a file from the virtual file system.
public GetFile ( string virtualPath ) : System.Web.Hosting.VirtualFile
virtualPath string The path to the virtual file.
Результат System.Web.Hosting.VirtualFile

Register() публичный статический Метод

Registers the EmbeddedResourceProvider within a HostingEnvironment.
This function will properly register the EmbeddedResourceProvider even when being run from within a pre-compiled web application.
public static Register ( ) : void
Результат void