Class ApiBuilder<TLoggerCategory, TDbContext>
Builder to add core services to a service collection.
Inheritance
Inherited Members
Namespace: Celerik.NetCore.Services
Assembly: cs.temp.dll.dll
Syntax
public class ApiBuilder<TLoggerCategory, TDbContext>
where TDbContext : DbContext
Type Parameters
| Name | Description |
|---|---|
| TLoggerCategory | The type who's name is used for the logger category name. |
| TDbContext | The type of DbContext. |
Constructors
ApiBuilder(IServiceCollection, IConfiguration)
Initializes a new instance of the class.
Declaration
public ApiBuilder(IServiceCollection services, IConfiguration config)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceCollection | services | Reference to the current IServiceCollection instance. |
| IConfiguration | config | Reference to the current IConfiguration instance. |
Properties
ServiceType
Gets the current service type.
Declaration
public ApiServiceType ServiceType { get; }
Property Value
| Type | Description |
|---|---|
| ApiServiceType |
Methods
AddAutomapper(Action<IMapperConfigurationExpression>)
Adds automapper to the current service collection.
Declaration
public ApiBuilder<TLoggerCategory, TDbContext> AddAutomapper(Action<IMapperConfigurationExpression> configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<IMapperConfigurationExpression> | configure | The configure callback. |
Returns
| Type | Description |
|---|---|
| ApiBuilder<TLoggerCategory, TDbContext> | Reference to the current ApiBuilder. |
AddBusinesServices(Action<IConfiguration>)
Adds business services to the current service collection.
Declaration
public ApiBuilder<TLoggerCategory, TDbContext> AddBusinesServices(Action<IConfiguration> configure)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<IConfiguration> | configure | The configure callback. |
Returns
| Type | Description |
|---|---|
| ApiBuilder<TLoggerCategory, TDbContext> | Reference to the current ApiBuilder. |
AddIdentity(IdentityOptions)
Adds AspNetIdentity services to the current service collection only if the AspNetIdentity connection string is defined in the configuration and the service type is ApiServiceType.ServiceEF.
Declaration
public ApiBuilder<TLoggerCategory, TDbContext> AddIdentity(IdentityOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IdentityOptions | options | Represents all the options you can use to configure the identity system. |
Returns
| Type | Description |
|---|---|
| ApiBuilder<TLoggerCategory, TDbContext> | Reference to the current ApiBuilder. |
AddValidators(Action)
Adds fluent validation to the current service collection.
Declaration
public ApiBuilder<TLoggerCategory, TDbContext> AddValidators(Action configure)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | configure | The configure callback. |
Returns
| Type | Description |
|---|---|
| ApiBuilder<TLoggerCategory, TDbContext> | Reference to the current ApiBuilder. |