add Base Controller, Complete Documentation and remove unncessary files ...
This commit is contained in:
@@ -6,6 +6,107 @@ its depends on:
|
||||
|
||||
- **xStringService**
|
||||
|
||||
## Providers
|
||||
|
||||
in this module all requirements tools for manage Terms and Conditions Integrated and Provided.
|
||||
|
||||
- **IXTermsAndComditionsProvider**: an Interface for Describe Provided Actions for Terms and Conditions Management.
|
||||
- **XTermsAndComditionsProvider**: an Implementation of Provided Actions for Terms and Conditions Management.
|
||||
- **XTermsHub**: a Hub Implementation for Notifing Terms Changes to Connected Clients.
|
||||
- **IXTermsAndComditionsController**: an Interface for Describe base Terms and Conditions Management Controller Actions.
|
||||
- **XTermsAndComditionsControllerBase**: an Abstract Base Implementation of base Terms and Conditions Management Controller Actions.
|
||||
|
||||
## Implementation
|
||||
|
||||
you have to follow these steps for using this Module.
|
||||
|
||||
### Configure Service
|
||||
|
||||
all of Requirements for Terms and Conditions must be Configured using appSettings and provided by IConfiguration to Modules.
|
||||
|
||||
fo using Service you Have to Configure the Service in you appSettings.json file.
|
||||
|
||||
this configurations mapped to **XTermsAndConditionsServiceConfiguration** class.
|
||||
|
||||
```C#
|
||||
/// <summary>
|
||||
/// Terms and Conditions Configuration ...
|
||||
/// </summary>
|
||||
public class XTermsAndConditionsServiceConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Terms And Conditions Resource Title in XString Table ...
|
||||
/// </summary>
|
||||
public string ResourceTitle { get; set; } = "terms_and_conditions";
|
||||
|
||||
/// <summary>
|
||||
/// Seeding Mode for Terms and Conditions ...
|
||||
/// </summary>
|
||||
public XDbSeedingMode SeedingMode { get; set; } = XDbSeedingMode.AddIfNotExists;
|
||||
|
||||
/// <summary>
|
||||
/// Default Terms and Conditions for Add to Databse on App Startup ...
|
||||
/// </summary>
|
||||
public List<XStringDto> TermsAndConditions { get; set; } = null;
|
||||
}
|
||||
```
|
||||
|
||||
a sample Configuration must like this:
|
||||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"TermsAndConditionsService": {
|
||||
"ResourceTitle": "terms_and_conditions",
|
||||
"SeedingMode": "AddIfNotExists",
|
||||
"TermsAndConditions": [
|
||||
{
|
||||
"Language": "fa-IR",
|
||||
"TranslatedValue": "شرایط و ضوابط ثبت نام در سامانه"
|
||||
}
|
||||
]
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Register Service
|
||||
|
||||
after preparation of all requirements, final steps is Register Service.
|
||||
|
||||
there are two main step:
|
||||
|
||||
- **DI Registration**: in this phase, all Provided Services Registered in DI.
|
||||
- **Middleware Usage**: in this phase, if any Terms and Conditions Provided in Configuration, Seeded in Data Persist System using Provided Services.
|
||||
|
||||
```C#
|
||||
public class Startup
|
||||
{
|
||||
//
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
...
|
||||
//
|
||||
// Register Terms and Conditions Service ...
|
||||
services.AddXTermsConditionsService(
|
||||
lifeTime: lifeTime,
|
||||
configuration: configuration
|
||||
);
|
||||
...
|
||||
}
|
||||
|
||||
//
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
...
|
||||
//
|
||||
// Using Terms and Conditions Service ...
|
||||
app.UseXTermsAndConditionsService();
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Maintainer
|
||||
|
||||
Hadi Khazaee asl
|
||||
|
||||
Reference in New Issue
Block a user