Browse Source
Merge pull request #3021 from abpframework/maliming/docs-options
Update options names in documentation.
pull/3043/head
Yunus Emre Kalkan
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with
34 additions and
34 deletions
docs/cs/AspNetCore/Widgets.md
docs/en/AspNetCore/Dynamic-CSharp-API-Clients.md
docs/en/AspNetCore/Widgets.md
docs/en/Localization.md
docs/en/Module-Development-Basics.md
docs/en/Multi-Tenancy.md
docs/pt-BR/Localization.md
docs/zh-Hans/AspNetCore/Dynamic-CSharp-API-Clients.md
docs/zh-Hans/AspNetCore/Widgets.md
docs/zh-Hans/Exception-Handling.md
docs/zh-Hans/Localization.md
docs/zh-Hans/Module-Development-Basics.md
docs/zh-Hans/Multi-Tenancy.md
@ -478,19 +478,19 @@ namespace DashboardDemo.Web.Pages.Components.MySimpleWidget
## WidgetOptions
## WidgetOptions
Jako alternativu k atributu `Widget` můžete ke konfiguraci widgetů použít `WidgetOptions` :
Jako alternativu k atributu `Widget` můžete ke konfiguraci widgetů použít `Abp WidgetOptions` :
```csharp
```csharp
Configure< WidgetOptions > (options =>
Configure< Abp WidgetOptions> (options =>
{
{
options.Widgets.Add< MySimpleWidgetViewComponent > ();
options.Widgets.Add< MySimpleWidgetViewComponent > ();
});
});
```
```
Toto vepište do metody `ConfigureServices` vašeho [modulu ](../Module-Development-Basics.md ). Veškerá konfigurace udělaná přes atribut `Widget` je dostupná i za pomoci `WidgetOptions` . Příklad konfigurace, která přidává styl pro widget:
Toto vepište do metody `ConfigureServices` vašeho [modulu ](../Module-Development-Basics.md ). Veškerá konfigurace udělaná přes atribut `Widget` je dostupná i za pomoci `Abp WidgetOptions` . Příklad konfigurace, která přidává styl pro widget:
````csharp
````csharp
Configure< WidgetOptions > (options =>
Configure< Abp WidgetOptions> (options =>
{
{
options.Widgets
options.Widgets
.Add< MySimpleWidgetViewComponent > ()
.Add< MySimpleWidgetViewComponent > ()
@ -498,7 +498,7 @@ Configure<WidgetOptions>(options =>
});
});
````
````
> Tip: `WidgetOptions` lze také použít k získání existujícího widgetu a ke změně jeho konfigurace. To je obzvláště užitečné, pokud chcete změnit konfiguraci widgetu uvnitř modulu používaného vaší aplikací. Použíjte `options.Widgets.Find` k získání existujícího `WidgetDefinition` .
> Tip: `Abp WidgetOptions` lze také použít k získání existujícího widgetu a ke změně jeho konfigurace. To je obzvláště užitečné, pokud chcete změnit konfiguraci widgetu uvnitř modulu používaného vaší aplikací. Použíjte `options.Widgets.Find` k získání existujícího `WidgetDefinition` .
## Podívejte se také na
## Podívejte se také na
@ -106,12 +106,12 @@ While you can inject `IBookAppService` like above to use the client proxy, you c
### RemoteServiceOptions
### RemoteServiceOptions
`RemoteServiceOptions` is automatically set from the `appsettings.json` by default. Alternatively, you can use `Configure` method to set or override it. Example:
`Abp RemoteServiceOptions` is automatically set from the `appsettings.json` by default. Alternatively, you can use `Configure` method to set or override it. Example:
````csharp
````csharp
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
context.Services.Configure< RemoteServiceOptions > (options =>
context.Services.Configure< Abp RemoteServiceOptions> (options =>
{
{
options.RemoteServices.Default =
options.RemoteServices.Default =
new RemoteServiceConfiguration("http://localhost:53929/");
new RemoteServiceConfiguration("http://localhost:53929/");
@ -147,7 +147,7 @@ context.Services.AddHttpClientProxies(
);
);
````
````
`remoteServiceName` parameter matches the service endpoint configured via `RemoteServiceOptions` . If the `BookStore` endpoint is not defined then it fallbacks to the `Default` endpoint.
`remoteServiceName` parameter matches the service endpoint configured via `Abp RemoteServiceOptions` . If the `BookStore` endpoint is not defined then it fallbacks to the `Default` endpoint.
### As Default Services
### As Default Services
@ -478,19 +478,19 @@ namespace DashboardDemo.Web.Pages.Components.MySimpleWidget
## WidgetOptions
## WidgetOptions
As alternative to the `Widget` attribute, you can use the `WidgetOptions` to configure widgets:
As alternative to the `Widget` attribute, you can use the `Abp WidgetOptions` to configure widgets:
```csharp
```csharp
Configure< WidgetOptions > (options =>
Configure< Abp WidgetOptions> (options =>
{
{
options.Widgets.Add< MySimpleWidgetViewComponent > ();
options.Widgets.Add< MySimpleWidgetViewComponent > ();
});
});
```
```
Write this into the `ConfigureServices` method of your [module ](../Module-Development-Basics.md ). All the configuration done with the `Widget` attribute is also possible with the `WidgetOptions` . Example configuration that adds a style for the widget:
Write this into the `ConfigureServices` method of your [module ](../Module-Development-Basics.md ). All the configuration done with the `Widget` attribute is also possible with the `Abp WidgetOptions` . Example configuration that adds a style for the widget:
````csharp
````csharp
Configure< WidgetOptions > (options =>
Configure< Abp WidgetOptions> (options =>
{
{
options.Widgets
options.Widgets
.Add< MySimpleWidgetViewComponent > ()
.Add< MySimpleWidgetViewComponent > ()
@ -498,7 +498,7 @@ Configure<WidgetOptions>(options =>
});
});
````
````
> Tip: `WidgetOptions` can also be used to get an existing widget and change its configuration. This is especially useful if you want to modify the configuration of a widget inside a module used by your application. Use `options.Widgets.Find` to get an existing `WidgetDefinition` .
> Tip: `Abp WidgetOptions` can also be used to get an existing widget and change its configuration. This is especially useful if you want to modify the configuration of a widget inside a module used by your application. Use `options.Widgets.Find` to get an existing `WidgetDefinition` .
## See Also
## See Also
@ -46,7 +46,7 @@ public class MyModule : AbpModule
{
{
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
Configure< VirtualFileSystemOptions > (options =>
Configure< Abp VirtualFileSystemOptions> (options =>
{
{
// "YourRootNameSpace" is the root namespace of your project. It can be empty if your root namespace is empty.
// "YourRootNameSpace" is the root namespace of your project. It can be empty if your root namespace is empty.
options.FileSets.AddEmbedded< MyModule > ("YourRootNameSpace");
options.FileSets.AddEmbedded< MyModule > ("YourRootNameSpace");
@ -67,7 +67,7 @@ In this example;
* Added a new localization resource with "en" (English) as the default culture.
* Added a new localization resource with "en" (English) as the default culture.
* Used JSON files to store the localization strings.
* Used JSON files to store the localization strings.
* JSON files are embedded into the assembly using `VirtualFileSystemOptions` (see [virtual file system ](Virtual-File-System.md )).
* JSON files are embedded into the assembly using `Abp VirtualFileSystemOptions` (see [virtual file system ](Virtual-File-System.md )).
JSON files are located under "/Localization/Resources/Test" project folder as shown below:
JSON files are located under "/Localization/Resources/Test" project folder as shown below:
@ -42,7 +42,7 @@ public class BlogModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
//Configure default connection string for the application
//Configure default connection string for the application
Configure< DbConnectionOptions > (options =>
Configure< Abp DbConnectionOptions> (options =>
{
{
options.ConnectionStrings.Default = "......";
options.ConnectionStrings.Default = "......";
});
});
@ -168,7 +168,7 @@ namespace MyCompany.MyProject
{
{
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
Configure< Configuration TenantStoreOptions> (options =>
Configure< AbpDefault TenantStoreOptions> (options =>
{
{
options.Tenants = new[]
options.Tenants = new[]
{
{
@ -214,7 +214,7 @@ namespace MyCompany.MyProject
{
{
var configuration = BuildConfiguration();
var configuration = BuildConfiguration();
Configure< Configuration TenantStoreOptions> (configuration);
Configure< AbpDefault TenantStoreOptions> (configuration);
}
}
private static IConfigurationRoot BuildConfiguration()
private static IConfigurationRoot BuildConfiguration()
@ -46,7 +46,7 @@ public class MyModule : AbpModule
{
{
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
Configure< VirtualFileSystemOptions > (options =>
Configure< Abp VirtualFileSystemOptions> (options =>
{
{
options.FileSets.AddEmbedded< MyModule > ();
options.FileSets.AddEmbedded< MyModule > ();
});
});
@ -66,7 +66,7 @@ Neste exemplo;
- Adicionado um novo recurso de localização com "en" (inglês) como a cultura padrão.
- Adicionado um novo recurso de localização com "en" (inglês) como a cultura padrão.
- Arquivos JSON usados para armazenar as sequências de localização.
- Arquivos JSON usados para armazenar as sequências de localização.
- Os arquivos JSON são incorporados ao assembly usando `VirtualFileSystemOptions` (consulte [sistema de arquivos virtual ](Virtual-File-System.md ) ).
- Os arquivos JSON são incorporados ao assembly usando `Abp VirtualFileSystemOptions` (consulte [sistema de arquivos virtual ](Virtual-File-System.md ) ).
Os arquivos JSON estão localizados na pasta do projeto "/ Localização / Recursos / Teste", como mostrado abaixo:
Os arquivos JSON estão localizados na pasta do projeto "/ Localização / Recursos / Teste", como mostrado abaixo:
@ -106,12 +106,12 @@ public class MyService : ITransientDependency
### RemoteServiceOptions
### RemoteServiceOptions
默认情况下`RemoteServiceOptions`从`appsettings.json`获取.或者,你可以使用`Configure`方法来设置或重写它.如:
默认情况下`Abp RemoteServiceOptions`从`appsettings.json`获取.或者,你可以使用`Configure`方法来设置或重写它.如:
````csharp
````csharp
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
context.Services.Configure< RemoteServiceOptions > (options =>
context.Services.Configure< Abp RemoteServiceOptions> (options =>
{
{
options.RemoteServices.Default =
options.RemoteServices.Default =
new RemoteServiceConfiguration("http://localhost:53929/");
new RemoteServiceConfiguration("http://localhost:53929/");
@ -147,7 +147,7 @@ context.Services.AddHttpClientProxies(
);
);
````
````
`remoteServiceName` 参数会匹配通过`RemoteServiceOptions`配置的服务端点.如果`BookStore`端点没有定义就会使用默认的`Default`端点.
`remoteServiceName` 参数会匹配通过`Abp RemoteServiceOptions`配置的服务端点.如果`BookStore`端点没有定义就会使用默认的`Default`端点.
### 作为默认服务
### 作为默认服务
@ -251,19 +251,19 @@ namespace DashboardDemo.Web.Pages.Components.MySimpleWidget
## 部件选项
## 部件选项
`WidgetOptions` 是 `Widget` attribute 替代, 你可以使用它去配置部件:
`Abp WidgetOptions` 是 `Widget` attribute 替代, 你可以使用它去配置部件:
```csharp
```csharp
Configure< WidgetOptions > (options =>
Configure< Abp WidgetOptions> (options =>
{
{
options.Widgets.Add< MySimpleWidgetViewComponent > ();
options.Widgets.Add< MySimpleWidgetViewComponent > ();
});
});
```
```
将上面的代码写到[模块](../Module-Development-Basics.md)的 `ConfigureServices` 方法中. `Widgeto ptions` 可以完成 `Widget` attribute 的所有功能. 比如为组件添加样式:
将上面的代码写到[模块](../Module-Development-Basics.md)的 `ConfigureServices` 方法中. `AbpWidgetO ptions` 可以完成 `Widget` attribute 的所有功能. 比如为组件添加样式:
````csharp
````csharp
Configure< WidgetOptions > (options =>
Configure< Abp WidgetOptions> (options =>
{
{
options.Widgets
options.Widgets
.Add< MySimpleWidgetViewComponent > ()
.Add< MySimpleWidgetViewComponent > ()
@ -271,4 +271,4 @@ Configure<WidgetOptions>(options =>
});
});
````
````
> 提示: `WidgetOptions` 还可以更改现有的部件配置. 如果要修改应用程序使用的模块内的组件配置,这会很有用. 使用 `options.Widgets.Find` 获取现有的 `WidgetDefinition` .
> 提示: `Abp WidgetOptions` 还可以更改现有的部件配置. 如果要修改应用程序使用的模块内的组件配置,这会很有用. 使用 `options.Widgets.Find` 获取现有的 `WidgetDefinition` .
@ -204,7 +204,7 @@ throw new UserFriendlyException(_stringLocalizer["UserNameShouldBeUniqueMessage"
首先,在模块配置代码中将 **code-namespace** 映射至 **本地化资源** :
首先,在模块配置代码中将 **code-namespace** 映射至 **本地化资源** :
````C#
````C#
services.Configure< ExceptionLocalizationOptions > (options =>
services.Configure< Abp ExceptionLocalizationOptions> (options =>
{
{
options.MapCodeNamespace("Volo.Qa", typeof(QaResource));
options.MapCodeNamespace("Volo.Qa", typeof(QaResource));
});
});
@ -285,7 +285,7 @@ ABP尝试按照以下规则,自动映射常见的异常类型的HTTP状态代码
可以重写HTTP状态代码的自动映射,示例如下:
可以重写HTTP状态代码的自动映射,示例如下:
````C#
````C#
services.Configure< ExceptionHttpStatusCodeOptions > (options =>
services.Configure< Abp ExceptionHttpStatusCodeOptions> (options =>
{
{
options.Map("Volo.Qa:010002", HttpStatusCode.Conflict);
options.Map("Volo.Qa:010002", HttpStatusCode.Conflict);
});
});
@ -46,7 +46,7 @@ public class MyModule : AbpModule
{
{
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
Configure< VirtualFileSystemOptions > (options =>
Configure< Abp VirtualFileSystemOptions> (options =>
{
{
// "YourRootNameSpace" 是项目的根命名空间名字. 如果你的项目的根命名空间名字为空,则无需传递此参数.
// "YourRootNameSpace" 是项目的根命名空间名字. 如果你的项目的根命名空间名字为空,则无需传递此参数.
options.FileSets.AddEmbedded< MyModule > ("YourRootNameSpace");
options.FileSets.AddEmbedded< MyModule > ("YourRootNameSpace");
@ -42,7 +42,7 @@ public class BlogModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
//为应用程序配置默认的连接字符串
//为应用程序配置默认的连接字符串
Configure< DbConnectionOptions > (options =>
Configure< Abp DbConnectionOptions> (options =>
{
{
options.ConnectionStrings.Default = "......";
options.ConnectionStrings.Default = "......";
});
});
@ -168,7 +168,7 @@ namespace MyCompany.MyProject
{
{
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
{
Configure< Configuration TenantStoreOptions> (options =>
Configure< AbpDefault TenantStoreOptions> (options =>
{
{
options.Tenants = new[]
options.Tenants = new[]
{
{
@ -214,7 +214,7 @@ namespace MyCompany.MyProject
{
{
var configuration = BuildConfiguration();
var configuration = BuildConfiguration();
Configure< Configuration TenantStoreOptions> (configuration);
Configure< AbpDefault TenantStoreOptions> (configuration);
}
}
private static IConfigurationRoot BuildConfiguration()
private static IConfigurationRoot BuildConfiguration()