last ...
This commit is contained in:
@@ -177,7 +177,7 @@ namespace xStringService.DI
|
||||
//
|
||||
descriptor = typeof(XStringServiceHelper)
|
||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||
methodName: "GetXStringEfRepositoryDescriptor",
|
||||
methodName: "GetXStringEFRepositoryDescriptor",
|
||||
runtimeType: contextType,
|
||||
args: null
|
||||
);
|
||||
|
||||
@@ -9,51 +9,6 @@ namespace xStringService.Extensions
|
||||
{
|
||||
public static class XModelExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts an Entity to Dto Representation ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static XStringDto ToXStringDto(this XString source)
|
||||
{
|
||||
//
|
||||
XStringDto result = new XStringDto();
|
||||
|
||||
//
|
||||
result.Id = source.Id;
|
||||
result.Language = source.Language;
|
||||
result.ResourceTitle = source.ResourceTitle;
|
||||
result.TranslatedValue = source.TranslatedValue;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Collection of Entities to Dto ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<XStringDto> ToXStringDtos(this IEnumerable<XString> source)
|
||||
{
|
||||
//
|
||||
var list = new List<XStringDto>();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool isValid = source.HasChild();
|
||||
if (!isValid)
|
||||
{
|
||||
return list.AsEnumerable();
|
||||
}
|
||||
|
||||
//
|
||||
var result = source.Select(e => ToXStringDto(e));
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts an Entity to LocaleResource Dto ...
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using GraphQL.Types;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
using xDataHelper.Providers.GraphQL;
|
||||
using xDataService.Db;
|
||||
using xDataService.Models;
|
||||
@@ -32,7 +31,7 @@ namespace xStringService.Helpers
|
||||
IXStringRepository,
|
||||
XStringEFRepository<TContext>,
|
||||
TContext
|
||||
> GetXStringEfRepositoryDescriptor<TContext>()
|
||||
> GetXStringEFRepositoryDescriptor<TContext>()
|
||||
where TContext : XDbContext
|
||||
{
|
||||
//
|
||||
@@ -76,7 +75,7 @@ namespace xStringService.Helpers
|
||||
TContext,
|
||||
IXStringSeeder,
|
||||
TSeederImplementation
|
||||
> GetXStringEfRepositoryDescriptor<TContext, TSeederImplementation>()
|
||||
> GetXStringEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
||||
where TContext : XDbContext
|
||||
where TSeederImplementation : XBaseDbSeeder<XString, int>
|
||||
{
|
||||
|
||||
@@ -4,6 +4,6 @@ using xStringService.Providers.Entities;
|
||||
|
||||
namespace xStringService.Interfaces.Entities
|
||||
{
|
||||
public interface IXStringRepositoryProvider : IXBaseEntityProviderr<XString, int, XStringEntityHub>
|
||||
public interface IXStringRepositoryProvider : IXBaseEntityProvider<XString, int, XStringEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -6,11 +6,8 @@ it is a Part of xDashboard on SaherElm IT Center which provides:
|
||||
|
||||
this module has following dependencies :
|
||||
|
||||
- xModels
|
||||
- xCommons
|
||||
- xDataService
|
||||
- xPushService
|
||||
- xIdentityModels
|
||||
- xIdentityService
|
||||
|
||||
for configure and use this Module refer to DI.XDIHelperExtension.cs file.
|
||||
@@ -615,6 +612,53 @@ public abstract class XBaseStringResourceProvider : IXBaseStringResourceProvider
|
||||
}
|
||||
```
|
||||
|
||||
### Controllers
|
||||
|
||||
there are some abstraction Layer of Controller Implementation for using Provided Services for managing data.
|
||||
|
||||
- **XStringRepositoryControllerBase**: an abstract Controller for Provide Repository Actions (using Entity).
|
||||
- **XStringRepositoryProviderControllerBase**: an abstract Controller for Provide Repository Actions (using Entity and XEntityHub).
|
||||
- **XStringServiceControllerBase**: an abstract Controller for Provide Service Actions (using Dto).
|
||||
- **XStringServiceProviderControllerBase**: an abstract Controller for Provide Service Actions (using Dto and XDtoHub).
|
||||
- **XBaseStringResourceProviderControllerBase**: an abstract Controller for Provide Actions for Base String Resources.
|
||||
|
||||
## 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 String Service ...
|
||||
services.AddXStringService<XApiDbContext>(
|
||||
lifeTime: lifeTime,
|
||||
repositoryType: xDataService.Constants.XRepositoryType.EF
|
||||
);
|
||||
...
|
||||
}
|
||||
|
||||
//
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
...
|
||||
//
|
||||
// Using String Service ...
|
||||
app.UseXStringService(
|
||||
isDevelopmentEnvironment: isDevelopmentEnvironment
|
||||
);
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Maintainer
|
||||
|
||||
Hadi Khazaee asl
|
||||
|
||||
Reference in New Issue
Block a user