Update virtual file system document.

pull/2151/head
Halil İbrahim Kalkan 6 years ago
parent 79cc798b6b
commit 9deb8804b2

@ -44,7 +44,7 @@ If you want to add multiple files, this can be tedious. Alternatively, you can d
This configuration recursively adds all files under the **MyResources** folder of the project (including the files you will add in the future).
Then the module needs to be configured using `VirtualFileSystemOptions` to register the embedded files to the virtual file system. Example:
Then the module needs to be configured using `AbpVirtualFileSystemOptions` to register the embedded files to the virtual file system. Example:
````C#
using Microsoft.Extensions.DependencyInjection;
@ -58,10 +58,10 @@ namespace MyCompany.MyProject
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<VirtualFileSystemOptions>(options =>
Configure<AbpVirtualFileSystemOptions>(options =>
{
//Register all embedded files of this assembly to the virtual file system
options.FileSets.AddEmbedded<MyModule>();
options.FileSets.AddEmbedded<MyModule>("YourRootNameSpace");
});
//...
@ -73,9 +73,12 @@ namespace MyCompany.MyProject
The `AddEmbedded` extension method takes a class, finds all embedded files from the assembly of the given class and registers them to the virtual file system. More concisely it could be written as follows:
````C#
options.FileSets.Add(new EmbeddedFileSet(typeof(MyModule).Assembly));
options.FileSets.Add(
new EmbeddedFileSet(typeof(MyModule).Assembly), "YourRootNameSpace");
````
> "YourRootNameSpace" is the root namespace of your project. It can be empty if your root namespace is empty.
#### Getting Virtual Files: IVirtualFileProvider
After embedding a file into an assembly and registering it to the virtual file system, the `IVirtualFileProvider` interface can be used to get files or directory contents:
@ -122,7 +125,7 @@ public class MyWebAppModule : AbpModule
if (hostingEnvironment.IsDevelopment()) //only for development time
{
Configure<VirtualFileSystemOptions>(options =>
Configure<AbpVirtualFileSystemOptions>(options =>
{
//ReplaceEmbeddedByPhysical gets the root folder of the MyModule project
options.FileSets.ReplaceEmbeddedByPhysical<MyModule>(

Loading…
Cancel
Save