From 9deb8804b2c18495fc7a43de80d1a68dfafc040a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 11 Nov 2019 08:26:24 +0300 Subject: [PATCH] Update virtual file system document. --- docs/en/Virtual-File-System.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/en/Virtual-File-System.md b/docs/en/Virtual-File-System.md index c89a2a34ef..d13bbf491b 100644 --- a/docs/en/Virtual-File-System.md +++ b/docs/en/Virtual-File-System.md @@ -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(options => + Configure(options => { //Register all embedded files of this assembly to the virtual file system - options.FileSets.AddEmbedded(); + options.FileSets.AddEmbedded("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(options => + Configure(options => { //ReplaceEmbeddedByPhysical gets the root folder of the MyModule project options.FileSets.ReplaceEmbeddedByPhysical(