last ...
This commit is contained in:
@@ -2,6 +2,213 @@
|
||||
|
||||
it is a Part of xDashboard on SaherElm IT Center which provides all Tag Related Futures ...
|
||||
|
||||
this module has following dependencies :
|
||||
|
||||
- xDataService
|
||||
- xPushService
|
||||
- xIdentityService
|
||||
|
||||
for configure and use this Module refer to DI.XDIHelperExtension.cs file.
|
||||
|
||||
## Tag
|
||||
|
||||
is a Global Identitifer which act as semantic value that can be represent some metadata about a data.
|
||||
|
||||
Tags can attach/detach to another Items for Describing Metadata about them.
|
||||
|
||||
**xDashboard** Provides Tag Management tools in this Module for adding this Feature to
|
||||
applications.
|
||||
|
||||
## Data Persists
|
||||
|
||||
all of Provided features of this Module is works based on Data Persistance. so data models is Very Important.
|
||||
in this section all Data models explained.
|
||||
|
||||
data manipulation done using **xDataService** provided Features.
|
||||
|
||||
- **XTag**: an Entity Model for Mapping to Tables.
|
||||
- **XTagDto**: a Data Transfer Object for Representing a Data Model.
|
||||
- **XTagEntityConfiguration**: a Configuration file for XTag Entity.
|
||||
- **XTagEntityHub**: a Hub Implementation for XTag Entity Model.
|
||||
- **XTagDtoHub**: a Hub Implementation for XTagDto Model.
|
||||
- **XTagEntityRegisterar**: an Implementation class for Dynamically Register XTag Entity in a DbContext.
|
||||
- **IXTagRepositoryEvents**: an Interface for Repository Events Describing of XTag Entity.
|
||||
- **XTagRepositoryEvents**: an Implementation for Repository Events of XTag Entity.
|
||||
- **IXTagKeyGenerator**: an Interface for Describing Key Generator Actions for XTag Entity.
|
||||
- **XTagKeyGenerator**: an Implementation for Describing Key Generator Actions for XTag Entity.
|
||||
- **IXTagRepository**: an Interface for Describing XTag Repository Actions.
|
||||
- **XTagEFRepository**: an Implementation of EF Core based XTag Repository Actions.
|
||||
- **XTagMongoRepository**: an Implementation of MongoDb based XTag Repository Actions.
|
||||
- **XTagMongoRepository**: an Implementation of MongoDb based XTag Repository Actions.
|
||||
- **XTagInMemoryRepository**: an Implementation of InMemory based XTag Repository Actions.
|
||||
- **IXTagSeeder**: an Interface for Describe XTag DbSeeder actions.
|
||||
- **XTagSeederBase**: an abstraction of Implementation of XTag DbSeeder actions.
|
||||
- **IXTagRepositoryProvider**: an Interface for Describing XTag Repository Provider (using Hubs) actions.
|
||||
- **XTagRepositoryProvider**: an Implementation of XTag Repository Provider (using Hubs) actions.
|
||||
- **IXTagRepositoryService**: an Interface for Describing XTag Repository Service Actions (using XTagDto).
|
||||
- **XTagRepositoryService**: an Implementation of XTag Repository Service Actions (using XTagDto).
|
||||
- **IXTagServiceProvider**: an Interface for Describing XTag Repository Service Actions Provider (using Hubs and XTagDto).
|
||||
- **XTagServiceProvider**: an Implementation of XTag Repository Service Actions Provider (using Hubs and XTagDto).
|
||||
- **XTagGraphType**: introduce XTag Data model for GraphQL using.
|
||||
- **XTagGraphQuery**: introduce Repositry Implementation of XTag model actions as Query Actions for GraphQL using.
|
||||
- **XTagGraphSchema**: introduce XTag Query Schema for GraphQL using.
|
||||
- **IXTagGraphQLTypeHelper**: an Interface for Describing XTag GraphQL Type Helper Provided Actions.
|
||||
- **IXTagGraphQLTypeHelper**: an Implementation of XTag GraphQL Type Helper Provided Actions.
|
||||
|
||||
data presistance almost is a Down Layer works which handled using Service it self.
|
||||
but in some Used cases of Applications Business Logics, for Manipulating resources you can use above Registered Services by Injecting them.
|
||||
|
||||
## Providers
|
||||
|
||||
this module actually used to act as a base Provider for implementing Features based on it.
|
||||
for this purpose, provides some Features which described in this section.
|
||||
|
||||
### String Resource Provider
|
||||
|
||||
some services used XTag model for Provide Specially Concept's of Actions. for example Terms and Conditions Services use XTag Persisted Resource for Specified Purpose.
|
||||
|
||||
this Module provides some sort of tools for this purpose. which described in this section.
|
||||
|
||||
#### Data Transfer Models
|
||||
|
||||
this service used some Data Transfer Models for Data Providing. which Described in this section.
|
||||
|
||||
```C#
|
||||
public class XReference<T>
|
||||
{
|
||||
public int Index { get; set; }
|
||||
public T ReferencedTo { get; set; }
|
||||
public string ProvidedFor { get; set; }
|
||||
}
|
||||
```
|
||||
|
||||
#### IXBaseTagProvider
|
||||
|
||||
an interface for Describe Provided Actions of Tag based Service.
|
||||
|
||||
```C#
|
||||
public interface IXBaseTagProvider<TKey> : IXBaseReferencedProvider<XTagDto, TKey>
|
||||
{
|
||||
//
|
||||
#region Tools ...
|
||||
/// <summary>
|
||||
/// Add Reference a Tag to Specific Provided ID ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddReference(
|
||||
string tag,
|
||||
TKey providedForId,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Reference a Tag to Specific XRefence<TKey> ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="reference"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddReference(
|
||||
string tag,
|
||||
XReference<TKey> reference,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Reference a Tag for Specific Provided ID ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReference(
|
||||
string tag,
|
||||
TKey providedForId,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Reference a Tag for Specific XRefence<TKey> ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="reference"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReference(
|
||||
string tag,
|
||||
XReference<TKey> reference,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
```
|
||||
|
||||
#### XBaseTagProvider
|
||||
|
||||
an implementation of Provided Actions of Resource based Service.
|
||||
|
||||
```C#
|
||||
public abstract class XBaseTagProvider<TKey> : IXBaseTagProvider<TKey>
|
||||
{ }
|
||||
```
|
||||
|
||||
### Controllers
|
||||
|
||||
there are some abstraction Layer of Controller Implementation for using Provided Services for managing data.
|
||||
|
||||
- **XTagRepositoryControllerBase**: an abstract Controller for Provide Repository Actions (using Entity).
|
||||
- **XTagRepositoryProviderControllerBase**: an abstract Controller for Provide Repository Actions (using Entity and XEntityHub).
|
||||
- **XTagServiceControllerBase**: an abstract Controller for Provide Service Actions (using Dto).
|
||||
- **XTagServiceProviderControllerBase**: an abstract Controller for Provide Service Actions (using Dto and XDtoHub).
|
||||
|
||||
## Implementation
|
||||
|
||||
you have to follow these steps for using this Module.
|
||||
|
||||
- **DI Registration**: in this phase, all Provided Services Registered in DI.
|
||||
- **Middleware Usage**: in this phase, Service Middlewares Use to Handle Features.
|
||||
|
||||
```C#
|
||||
public class Startup
|
||||
{
|
||||
//
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
...
|
||||
//
|
||||
// Register Tag Service ...
|
||||
services.AddXTagService<XApiDbContext>(
|
||||
lifeTime: lifeTime,
|
||||
repositoryType: xDataService.Constants.XRepositoryType.EF
|
||||
);
|
||||
...
|
||||
}
|
||||
|
||||
//
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
...
|
||||
//
|
||||
// Using Tag Service ...
|
||||
app.UseXTagService(
|
||||
isDevelopmentEnvironment: isDevelopmentEnvironment
|
||||
);
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Maintainer
|
||||
|
||||
Hadi Khazaee asl
|
||||
|
||||
Reference in New Issue
Block a user