Compare commits
10
Commits
3e141bd70f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39d859b8ad | ||
|
|
01c2a04977 | ||
|
|
3d5f2c4953 | ||
|
|
ac93d4da93 | ||
|
|
e494dea3cf | ||
|
|
65ba20c98d | ||
|
|
35683997d1 | ||
|
|
10f5c463db | ||
|
|
221442307e | ||
|
|
3ca3bf05e9 |
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xStringService.Constants;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
namespace xStringService.Configurations.Entities
|
namespace xStringService.Configurations.Entities
|
||||||
@@ -9,7 +10,7 @@ namespace xStringService.Configurations.Entities
|
|||||||
{
|
{
|
||||||
public override void Configure(EntityTypeBuilder<XString> builder)
|
public override void Configure(EntityTypeBuilder<XString> builder)
|
||||||
{
|
{
|
||||||
builder.ToTable("Strings");
|
builder.ToTable(XStringServiceConstants.XStringTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
namespace xStringService.Constants
|
||||||
|
{
|
||||||
|
public struct XStringServiceConstants
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Service Extensions Log Tag ...
|
||||||
|
public const string XStringServiceDILogTag = "XStringService";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Table Mapping Identifiers ...
|
||||||
|
public const string XStringTable = "Strings";
|
||||||
|
|
||||||
|
//
|
||||||
|
// GraphQL Collection Mappings ...
|
||||||
|
public const string XStringSingleName = "string";
|
||||||
|
public const string XStringCollectionName = "strings";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hubs ...
|
||||||
|
public const string XStringDtoHub = "stringDto";
|
||||||
|
public const string XStringEntityHub = "stringEntity";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custome Constants ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// EF Repositories Helper Extensions ...
|
||||||
|
public const string GetXStringEFRepositoryDescriptor = "GetXStringEFRepositoryDescriptor";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,398 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using xCommons.Configurations;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using xCommons.Providers;
|
||||||
|
using xExceptions.Constants;
|
||||||
|
using xIdentityService.Controllers;
|
||||||
|
using xIdentityService.Interfaces;
|
||||||
|
using xModels.Dtos;
|
||||||
|
using xStringService.Interfaces;
|
||||||
|
using xStringService.Models.Dtos;
|
||||||
|
|
||||||
|
namespace xStringService.Controllers
|
||||||
|
{
|
||||||
|
public abstract class XBaseItemResourceProviderControllerBase : XBaseIdentityApiV1Controller, IXBaseItemResourceProviderController
|
||||||
|
{
|
||||||
|
private readonly IXItemResourceProvider provider;
|
||||||
|
|
||||||
|
protected XBaseItemResourceProviderControllerBase(
|
||||||
|
ILogger<XBaseItemResourceProviderControllerBase> logger,
|
||||||
|
XAppConfiguration appConfiguration,
|
||||||
|
IXIdentityProvider identityProvider,
|
||||||
|
XValidationProvider validationProvider,
|
||||||
|
IXItemResourceProvider provider
|
||||||
|
) : base(
|
||||||
|
logger,
|
||||||
|
appConfiguration,
|
||||||
|
identityProvider,
|
||||||
|
validationProvider
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Actions ...
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve a List of Exists Languages ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier">if null or empty, check all languages in Item Side</param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Languages")]
|
||||||
|
public virtual async Task<ActionResult<IEnumerable<string>>> GetLanguages(
|
||||||
|
[FromQuery] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = Enumerable.Empty<string>();
|
||||||
|
if (!identifier.IsNull())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = await provider.GetLanguages(
|
||||||
|
identifier: identifier,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = await provider.GetLanguages(
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok(result.ToDynamicObject());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve all Exists Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resource">Specified Resource Title</param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("ResourceLocales")]
|
||||||
|
public virtual async Task<ActionResult<IEnumerable<XStringDto>>> GetResourceLocales(
|
||||||
|
[FromQuery] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = Enumerable.Empty<XStringDto>();
|
||||||
|
if (!identifier.IsNull())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = await provider.GetResourceLocales(
|
||||||
|
identifier: identifier,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = await provider.GetResourceLocales(
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok(result.ToDynamicObject());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Items for Specified identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Locales/{identifier}")]
|
||||||
|
public virtual async Task<ActionResult<IEnumerable<XLocaleResourceDto>>> GetLocales(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Specified Language Locale of Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language">if null or empty Remove all Locales</param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("Locales/{identifier}")]
|
||||||
|
public virtual async Task<ActionResult<XResourceDto>> RemoveLocale(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromQuery] string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid = !identifier.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Connection ID ...
|
||||||
|
var connectionId = GetConnectionId();
|
||||||
|
|
||||||
|
//
|
||||||
|
XResourceDto result = null;
|
||||||
|
if (!language.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = await provider.RemoveLocale(
|
||||||
|
language: language,
|
||||||
|
identifier: identifier,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await provider.RemoveLocales(
|
||||||
|
identifier: identifier,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok(result.ToDynamicObject());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check Specified ocale Exists for Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Locales/{identifier}/{language}/Has")]
|
||||||
|
public virtual async Task<ActionResult<bool>> HasLocale(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromRoute] string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
await ValidationProvider
|
||||||
|
.GroupValidationBuilder()
|
||||||
|
.AddNotEmpty(language)
|
||||||
|
.AddNotNull(identifier)
|
||||||
|
.ValidateGroupAsync();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Result ...
|
||||||
|
var result = await provider.HasLocale(
|
||||||
|
language: language,
|
||||||
|
identifier: identifier,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Locales Representaion based on Specified Identitifer
|
||||||
|
/// as XResourceDto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Resource/{identifier}")]
|
||||||
|
public virtual async Task<ActionResult<XResourceDto>> GetResource(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
ValidationProvider.NotNull(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await provider.GetResource(
|
||||||
|
identifier: identifier,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok(result.ToDynamicObject());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Or Update Locale for Specified Identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("Locales/{identifier}")]
|
||||||
|
public virtual async Task<ActionResult<XResourceDto>> AddOrUpdateLocale(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromBody] XLocaleResourceDto locale,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
await ValidationProvider
|
||||||
|
.GroupValidationBuilder()
|
||||||
|
.AddNotNull(identifier)
|
||||||
|
.AddNotNull(locale)
|
||||||
|
.AddNotEmpty(locale.Value)
|
||||||
|
.AddNotEmpty(locale.Language)
|
||||||
|
.ValidateGroupAsync();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Connection ID ...
|
||||||
|
var connectionId = GetConnectionId();
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await provider.AddOrUpdateLocale(
|
||||||
|
locale: locale,
|
||||||
|
identifier: identifier,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok(result.ToDynamicObject());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update a Resource State ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("Resource/{identifier}")]
|
||||||
|
public virtual async Task<ActionResult<XResourceDto>> AddOrUpdateResource(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromBody] XResourceDto resource,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
await ValidationProvider
|
||||||
|
.GroupValidationBuilder()
|
||||||
|
.AddNotNull(identifier)
|
||||||
|
.AddNotNull(resource)
|
||||||
|
.ValidateGroupAsync();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Connection ID ...
|
||||||
|
var connectionId = GetConnectionId();
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await provider.AddOrUpdateResource(
|
||||||
|
resource: resource,
|
||||||
|
identifier: identifier,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return Ok(result.ToDynamicObject());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = GetExceptionActionResult(ex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ using xPushService.Helpers;
|
|||||||
using xPushService.DI;
|
using xPushService.DI;
|
||||||
using xStringService.Interfaces;
|
using xStringService.Interfaces;
|
||||||
using xStringService.Providers;
|
using xStringService.Providers;
|
||||||
|
using xStringService.Constants;
|
||||||
|
|
||||||
namespace xStringService.DI
|
namespace xStringService.DI
|
||||||
{
|
{
|
||||||
@@ -80,8 +81,8 @@ namespace xStringService.DI
|
|||||||
var pushHelper = new XPushServiceHelper();
|
var pushHelper = new XPushServiceHelper();
|
||||||
|
|
||||||
//
|
//
|
||||||
pushHelper.AddHub<XStringDtoHub>("stringDto");
|
pushHelper.AddHub<XStringDtoHub>(XStringServiceConstants.XStringDtoHub);
|
||||||
pushHelper.AddHub<XStringEntityHub>("stringEntity");
|
pushHelper.AddHub<XStringEntityHub>(XStringServiceConstants.XStringEntityHub);
|
||||||
|
|
||||||
//
|
//
|
||||||
app.UseXPushService(pushHelper);
|
app.UseXPushService(pushHelper);
|
||||||
@@ -106,7 +107,7 @@ namespace xStringService.DI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a LogTag for Service ...
|
/// a LogTag for Service ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string XLogTag = "XStringService";
|
private static string XLogTag = XStringServiceConstants.XStringServiceDILogTag;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// print a log in Console ...
|
/// print a log in Console ...
|
||||||
@@ -179,9 +180,9 @@ namespace xStringService.DI
|
|||||||
//
|
//
|
||||||
descriptor = typeof(XStringServiceHelper)
|
descriptor = typeof(XStringServiceHelper)
|
||||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||||
methodName: "GetXStringEFRepositoryDescriptor",
|
args: null,
|
||||||
runtimeType: contextType,
|
runtimeType: contextType,
|
||||||
args: null
|
methodName: XStringServiceConstants.GetXStringEFRepositoryDescriptor
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
namespace xStringService.Interfaces
|
namespace xStringService.Interfaces.Entities
|
||||||
{
|
{
|
||||||
public interface IXStringSeeder : IXBaseDbSeeder<XString, int>
|
public interface IXStringSeeder : IXBaseDbSeeder<XString, int>
|
||||||
{}
|
{}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using xModels.Dtos;
|
||||||
|
using xStringService.Models.Dtos;
|
||||||
|
|
||||||
|
namespace xStringService.Interfaces
|
||||||
|
{
|
||||||
|
public interface IXBaseItemResourceProviderController
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve a List of Exists Languages ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier">if null or empty, check all languages in Item Side</param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Languages")]
|
||||||
|
Task<ActionResult<IEnumerable<string>>> GetLanguages(
|
||||||
|
[FromQuery] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve all Exists Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resource">Specified Resource Title</param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("ResourceLocales")]
|
||||||
|
Task<ActionResult<IEnumerable<XStringDto>>> GetResourceLocales(
|
||||||
|
[FromQuery] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Items for Specified identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Locales/{identifier}")]
|
||||||
|
Task<ActionResult<IEnumerable<XLocaleResourceDto>>> GetLocales(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Specified Language Locale of Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language">if null or empty Remove all Locales</param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("Locales/{identifier}")]
|
||||||
|
Task<ActionResult<XResourceDto>> RemoveLocale(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromQuery] string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check Specified ocale Exists for Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Locales/{identifier}/{language}/Has")]
|
||||||
|
Task<ActionResult<bool>> HasLocale(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromRoute] string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Locales Representaion based on Specified Identitifer
|
||||||
|
/// as XResourceDto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Resource/{identifier}")]
|
||||||
|
Task<ActionResult<XResourceDto>> GetResource(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Or Update Locale for Specified Identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("Locales/{identifier}")]
|
||||||
|
Task<ActionResult<XResourceDto>> AddOrUpdateLocale(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromBody] XLocaleResourceDto locale,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update a Resource State ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("Resource/{identifier}")]
|
||||||
|
Task<ActionResult<XResourceDto>> AddOrUpdateResource(
|
||||||
|
[FromRoute] object identifier,
|
||||||
|
[FromBody] XResourceDto resource,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using xModels.Dtos;
|
||||||
using xStringService.Models.Dtos;
|
using xStringService.Models.Dtos;
|
||||||
|
|
||||||
namespace xStringService.Interfaces
|
namespace xStringService.Interfaces
|
||||||
@@ -8,7 +9,7 @@ namespace xStringService.Interfaces
|
|||||||
public interface IXItemResourceProvider
|
public interface IXItemResourceProvider
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
#region All Item Actions ...
|
#region Group Actions ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve a List of Exists Languages for Current Item ...
|
/// Retrieve a List of Exists Languages for Current Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -26,23 +27,23 @@ namespace xStringService.Interfaces
|
|||||||
Task<IEnumerable<XStringDto>> GetResourceLocales(
|
Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all Exists Locales which Related to this Provider ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task RemoveResourceLocales(
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Single Item Actions ...
|
#region Item Actions ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve a List of Exists Languages for Current Item ...
|
/// Get all Exists Items for Specified identitifer ...
|
||||||
/// </summary>
|
|
||||||
/// <param name="identifier"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<IEnumerable<string>> GetLanguages(
|
|
||||||
object identifier,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve all Exists Items of type ...
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="identifier"></param>
|
/// <param name="identifier"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
@@ -51,6 +52,121 @@ namespace xStringService.Interfaces
|
|||||||
object identifier,
|
object identifier,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Items for Specified identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XLocaleResourceDto>> GetLocales(
|
||||||
|
object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Locales Representaion based on Specified Identitifer
|
||||||
|
/// as XResourceDto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XResourceDto> GetResource(
|
||||||
|
object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Or Update Locale for Specified Identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XResourceDto> AddOrUpdateLocale(
|
||||||
|
object identifier,
|
||||||
|
XLocaleResourceDto locale,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update a Resource State ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XResourceDto> AddOrUpdateResource(
|
||||||
|
object identifier,
|
||||||
|
XResourceDto resource,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Specified Language Locale of Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XResourceDto> RemoveLocale(
|
||||||
|
object identifier,
|
||||||
|
string language,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all Exists Locales for Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task RemoveLocales(
|
||||||
|
object identifier,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check Specified ocale Exists for Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> HasLocale(
|
||||||
|
object identifier,
|
||||||
|
string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Languages for Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<string>> GetLanguages(
|
||||||
|
object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Resource Title Action ...
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Resource Title ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
string GetResourceTitle(object identifier = null);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using xIdentityModels.Models;
|
|
||||||
using xModels.Dtos;
|
using xModels.Dtos;
|
||||||
using xStringService.Models.Dtos;
|
using xStringService.Models.Dtos;
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ namespace xStringService.Interfaces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve all Exists Items ...
|
/// Retrieve all Exists Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resource">Specified Resource Title</param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XStringDto>> GetResourceLocales(
|
Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||||
@@ -83,13 +81,11 @@ namespace xStringService.Interfaces
|
|||||||
/// Add or Update a Resource Model ...
|
/// Add or Update a Resource Model ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resource">a XResourceDto Model ...</param>
|
/// <param name="resource">a XResourceDto Model ...</param>
|
||||||
/// <param name="userInfo">Actor User for Permissions ...</param>
|
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XResourceDto> AddOrUpdateResource(
|
Task<XResourceDto> AddOrUpdateResource(
|
||||||
XResourceDto resource,
|
XResourceDto resource,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
@@ -98,13 +94,11 @@ namespace xStringService.Interfaces
|
|||||||
/// Add Or Update Locale ...
|
/// Add Or Update Locale ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="locale"></param>
|
/// <param name="locale"></param>
|
||||||
/// <param name="userInfo">Actor User for Permissions ...</param>
|
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XResourceDto> AddOrUpdateLocale(
|
Task<XResourceDto> AddOrUpdateLocale(
|
||||||
XLocaleResourceDto locale,
|
XLocaleResourceDto locale,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
@@ -113,13 +107,11 @@ namespace xStringService.Interfaces
|
|||||||
/// Remove Locale ...
|
/// Remove Locale ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="locale"></param>
|
/// <param name="locale"></param>
|
||||||
/// <param name="userInfo">Actor User for Permissions ...</param>
|
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XResourceDto> RemoveLocale(
|
Task<XResourceDto> RemoveLocale(
|
||||||
XLocaleResourceDto locale,
|
XLocaleResourceDto locale,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
@@ -128,13 +120,11 @@ namespace xStringService.Interfaces
|
|||||||
/// Remove Specified Resource Model ...
|
/// Remove Specified Resource Model ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resource">a XResourceDto Model ...</param>
|
/// <param name="resource">a XResourceDto Model ...</param>
|
||||||
/// <param name="userInfo">Actor User for Permissions ...</param>
|
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task RemoveResource(
|
Task RemoveResource(
|
||||||
XResourceDto resource,
|
XResourceDto resource,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Interfaces;
|
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
using xStringService.Interfaces;
|
using xStringService.Interfaces.Entities;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
namespace xStringService.Providers
|
namespace xStringService.Providers.Entities
|
||||||
{
|
{
|
||||||
public abstract class XStringSeederBase : XBaseDbSeeder<XString, int>, IXStringSeeder
|
public abstract class XStringSeederBase : XBaseDbSeeder<XString, int>, IXStringSeeder
|
||||||
{
|
{
|
||||||
protected XStringSeederBase(
|
protected XStringSeederBase(
|
||||||
string entity,
|
string entity,
|
||||||
string database,
|
string database,
|
||||||
IXBaseRepository<XString, int> repository,
|
IXStringRepository repository,
|
||||||
XDataServiceConfiguration dataServiceConfiguration
|
XDataServiceConfiguration dataServiceConfiguration
|
||||||
) : base(
|
) : base(
|
||||||
entity,
|
entity,
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xStringService.Constants;
|
||||||
using xStringService.Interfaces.Entities;
|
using xStringService.Interfaces.Entities;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
@@ -14,12 +15,12 @@ namespace xStringService.Providers.GraphQL
|
|||||||
|
|
||||||
public override string GetInQueryCollectionName()
|
public override string GetInQueryCollectionName()
|
||||||
{
|
{
|
||||||
return "strings";
|
return XStringServiceConstants.XStringCollectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetInQuerySingleName()
|
public override string GetInQuerySingleName()
|
||||||
{
|
{
|
||||||
return "string";
|
return XStringServiceConstants.XStringSingleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xExceptions.Constants;
|
using xExceptions.Constants;
|
||||||
|
using xModels.Dtos;
|
||||||
using xStringService.Interfaces;
|
using xStringService.Interfaces;
|
||||||
using xStringService.Interfaces.Dtos;
|
using xStringService.Interfaces.Dtos;
|
||||||
using xStringService.Models.Dtos;
|
using xStringService.Models.Dtos;
|
||||||
@@ -13,6 +14,8 @@ namespace xStringService.Providers
|
|||||||
{
|
{
|
||||||
public abstract class XBaseItemResourceProvider : IXItemResourceProvider
|
public abstract class XBaseItemResourceProvider : IXItemResourceProvider
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
#region Props ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Item Name for Resource Providing ...
|
/// Item Name for Resource Providing ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -28,6 +31,7 @@ namespace xStringService.Providers
|
|||||||
/// String Provider Service ...
|
/// String Provider Service ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IXStringServiceProvider stringProvider;
|
private readonly IXStringServiceProvider stringProvider;
|
||||||
|
#endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Constructor ...
|
#region Constructor ...
|
||||||
@@ -47,22 +51,20 @@ namespace xStringService.Providers
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
#region All Item Actions ...
|
#region Group Actions ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve a List of Exists Languages for Current Item ...
|
/// Retrieve a List of Exists Languages for Current Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IEnumerable<string>> GetLanguages(
|
public virtual async Task<IEnumerable<string>> GetLanguages(
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result =
|
var result = (await ExtractItems(cancellationToken))
|
||||||
(await GetResourceLocales(cancellationToken))
|
|
||||||
.Select(x => x.Language)
|
.Select(x => x.Language)
|
||||||
.Distinct()
|
.Distinct();
|
||||||
.ToList();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -73,39 +75,416 @@ namespace xStringService.Providers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IEnumerable<XStringDto>> GetResourceLocales(
|
public virtual async Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var identifier = GetResourceTitle();
|
var result = await ExtractItems(cancellationToken);
|
||||||
var result = await stringProvider
|
|
||||||
.FindManyAsync(
|
//
|
||||||
includeBuilder: null,
|
return result;
|
||||||
ignoreSoftDeleteds: true,
|
}
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
orderBuilder:
|
/// <summary>
|
||||||
x => x
|
/// Remove all Exists Locales which Related to this Provider ...
|
||||||
.OrderBy(y => y.Language)
|
/// </summary>
|
||||||
.ThenBy(y => y.ResourceTitle),
|
/// <param name="connectionId"></param>
|
||||||
predicate: x =>
|
/// <param name="cancellationToken"></param>
|
||||||
x.ResourceTitle.StartsWith(identifier, StringComparison.InvariantCultureIgnoreCase)
|
/// <returns></returns>
|
||||||
|
public virtual async Task RemoveResourceLocales(
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var isDelete = false;
|
||||||
|
XStringDto deleted = null;
|
||||||
|
var items = await ExtractItems(cancellationToken);
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Cancellation ...
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remove Item ...
|
||||||
|
deleted = await stringProvider.RemoveAsync(
|
||||||
|
id: item.Id,
|
||||||
|
softDelete: false,
|
||||||
|
saveChanges: true,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Removation Succeed ...
|
||||||
|
isDelete = !deleted.IsNullOrDefault();
|
||||||
|
if (!isDelete)
|
||||||
|
{
|
||||||
|
XException.ActionFailed.Throw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Item Actions ...
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Items for Specified identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XStringDto>> GetResourceLocales(
|
||||||
|
object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid = !identifier.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Resource List ...
|
||||||
|
var result = await provider
|
||||||
|
.GetResourceLocales(cancellationToken);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Items for Specified identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XLocaleResourceDto>> GetLocales(
|
||||||
|
object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid = !identifier.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Resource List ...
|
||||||
|
var result = await provider
|
||||||
|
.GetLocales(cancellationToken);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Locales Representaion based on Specified Identitifer
|
||||||
|
/// as XResourceDto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XResourceDto> GetResource(
|
||||||
|
object identifier,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid = !identifier.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Resource List ...
|
||||||
|
var result = await provider
|
||||||
|
.GetResource(cancellationToken);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Or Update Locale for Specified Identitifer ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XResourceDto> AddOrUpdateLocale(
|
||||||
|
object identifier,
|
||||||
|
XLocaleResourceDto locale,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!identifier.IsNull() &&
|
||||||
|
!locale.IsNullOrDefault() &&
|
||||||
|
!locale.Value.IsNullOrEmpty() &&
|
||||||
|
!locale.Language.IsNullOrEmpty();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Resource List ...
|
||||||
|
var result = await provider
|
||||||
|
.AddOrUpdateLocale(
|
||||||
|
locale: locale,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
//
|
|
||||||
#region Single Item Actions ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve a List of Exists Languages for Current Item ...
|
/// Update a Resource State ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XResourceDto> AddOrUpdateResource(
|
||||||
|
object identifier,
|
||||||
|
XResourceDto resource,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!identifier.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Identified Resource Title ...
|
||||||
|
var identifiedResource = GetResourceTitle(identifier);
|
||||||
|
isValid =
|
||||||
|
!resource.IsNullOrDefault() &&
|
||||||
|
(resource.Resource.IsNullOrEmpty() ||
|
||||||
|
resource.Resource == identifiedResource);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
if (resource.Resource.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
resource.Resource = identifiedResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Resource List ...
|
||||||
|
var result = await provider
|
||||||
|
.AddOrUpdateResource(
|
||||||
|
resource: resource,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Specified Language Locale of Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XResourceDto> RemoveLocale(
|
||||||
|
object identifier,
|
||||||
|
string language,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!identifier.IsNull() &&
|
||||||
|
!language.IsNullOrEmpty();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Locale Exists ...
|
||||||
|
isValid = await HasLocale(
|
||||||
|
language: language,
|
||||||
|
identifier: identifier,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var locale = (await GetLocales(
|
||||||
|
identifier: identifier,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
))
|
||||||
|
.FirstOrDefault(x =>
|
||||||
|
x.Language.Equals(language, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
isValid = !locale.IsNullOrDefault();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await provider.RemoveLocale(
|
||||||
|
locale: locale,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all Exists Locales for Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task RemoveLocales(
|
||||||
|
object identifier,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!identifier.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var resource = await GetResource(
|
||||||
|
identifier: identifier,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
isValid = !resource.IsNullOrDefault();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
await provider.RemoveResource(
|
||||||
|
resource: resource,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check Specified ocale Exists for Specified Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> HasLocale(
|
||||||
|
object identifier,
|
||||||
|
string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!identifier.IsNull() &&
|
||||||
|
!language.IsNullOrEmpty();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting Resource Title ...
|
||||||
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await provider.HasLocale(
|
||||||
|
language: language,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Exists Languages for Specified Identifier ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="identifier"></param>
|
/// <param name="identifier"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IEnumerable<string>> GetLanguages(
|
public virtual async Task<IEnumerable<string>> GetLanguages(
|
||||||
object identifier,
|
object identifier,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
@@ -119,48 +498,26 @@ namespace xStringService.Providers
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Identifier ...
|
// Setting Resource Title ...
|
||||||
SetResourceTitle(identifier);
|
SetResourceTitle(identifier);
|
||||||
|
|
||||||
//
|
//
|
||||||
var result =
|
var result = await provider
|
||||||
await provider.GetLanguages(cancellationToken);
|
.GetLanguages(cancellationToken);
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve all Exists Items of type ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="identifier"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<IEnumerable<XStringDto>> GetResourceLocales(
|
|
||||||
object identifier,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Validate ...
|
|
||||||
var isValid = !identifier.IsNull();
|
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
XException.InvalidArgs.Throw();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Identifier ...
|
|
||||||
SetResourceTitle(identifier);
|
|
||||||
|
|
||||||
//
|
|
||||||
var result =
|
|
||||||
await provider.GetResourceLocales(cancellationToken);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Private ...
|
#region Resource Title Action ...
|
||||||
private string GetResourceTitle(object identifier = null)
|
/// <summary>
|
||||||
|
/// Retrieve Resource Title ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetResourceTitle(object identifier = null)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = item;
|
var result = item;
|
||||||
@@ -174,7 +531,14 @@ namespace xStringService.Providers
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Private ...
|
||||||
|
/// <summary>
|
||||||
|
/// Set Resource Title ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
private void SetResourceTitle(object identifier = null)
|
private void SetResourceTitle(object identifier = null)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -184,6 +548,29 @@ namespace xStringService.Providers
|
|||||||
value: $"{itemIdentifier}"
|
value: $"{itemIdentifier}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// xtract all Items which Belongs to Provider ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<IEnumerable<XStringDto>> ExtractItems(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await stringProvider
|
||||||
|
.FindManyAsync(
|
||||||
|
includeBuilder: null,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
orderBuilder: x => x.OrderBy(y => y.Id),
|
||||||
|
predicate: x =>
|
||||||
|
x.ResourceTitle.StartsWith(
|
||||||
|
item,
|
||||||
|
StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xExceptions.Constants;
|
using xExceptions.Constants;
|
||||||
using xIdentityModels.Models;
|
|
||||||
using xModels.Dtos;
|
using xModels.Dtos;
|
||||||
using xStringService.Extensions;
|
using xStringService.Extensions;
|
||||||
using xStringService.Interfaces;
|
using xStringService.Interfaces;
|
||||||
@@ -181,13 +180,11 @@ namespace xStringService.Providers
|
|||||||
/// Add or Update a Resource Model ...
|
/// Add or Update a Resource Model ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resource">a XResourceDto Model ...</param>
|
/// <param name="resource">a XResourceDto Model ...</param>
|
||||||
/// <param name="userInfo">Actor User for Permissions ...</param>
|
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XResourceDto> AddOrUpdateResource(
|
public virtual async Task<XResourceDto> AddOrUpdateResource(
|
||||||
XResourceDto resource,
|
XResourceDto resource,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
@@ -209,7 +206,6 @@ namespace xStringService.Providers
|
|||||||
{
|
{
|
||||||
await RemoveResource(
|
await RemoveResource(
|
||||||
resource: result,
|
resource: result,
|
||||||
userInfo: userInfo,
|
|
||||||
connectionId: connectionId,
|
connectionId: connectionId,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
@@ -248,7 +244,6 @@ namespace xStringService.Providers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XResourceDto> AddOrUpdateLocale(
|
public virtual async Task<XResourceDto> AddOrUpdateLocale(
|
||||||
XLocaleResourceDto locale,
|
XLocaleResourceDto locale,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
@@ -297,11 +292,11 @@ namespace xStringService.Providers
|
|||||||
/// Remove Locale ...
|
/// Remove Locale ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="locale"></param>
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XResourceDto> RemoveLocale(
|
public virtual async Task<XResourceDto> RemoveLocale(
|
||||||
XLocaleResourceDto locale,
|
XLocaleResourceDto locale,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
@@ -334,17 +329,26 @@ namespace xStringService.Providers
|
|||||||
/// Remove Specified Resource Model ...
|
/// Remove Specified Resource Model ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resource">a XResourceDto Model ...</param>
|
/// <param name="resource">a XResourceDto Model ...</param>
|
||||||
/// <param name="userInfo">Actor User for Permissions ...</param>
|
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task RemoveResource(
|
public virtual async Task RemoveResource(
|
||||||
XResourceDto resource,
|
XResourceDto resource,
|
||||||
XUserClaimsInfoDto userInfo = null,
|
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Validate Resource ...
|
||||||
|
var isValid =
|
||||||
|
!resource.IsNullOrDefault() &&
|
||||||
|
!resource.Resource.IsNullOrEmpty() &&
|
||||||
|
resource.Resource == this.resource;
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
var items = await ExtractItems(cancellationToken);
|
var items = await ExtractItems(cancellationToken);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xStringService.Configurations.Entities;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
namespace xStringService.Providers
|
namespace xStringService.Providers
|
||||||
@@ -24,6 +25,12 @@ namespace xStringService.Providers
|
|||||||
/// <param name="modelBuilder"></param>
|
/// <param name="modelBuilder"></param>
|
||||||
public override void ConfigureEntities(ModelBuilder modelBuilder)
|
public override void ConfigureEntities(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Configure Entity Using Provided ...
|
||||||
|
modelBuilder
|
||||||
|
.ApplyConfigurationsFromAssembly(typeof(XStringEntityConfiguration).Assembly);
|
||||||
|
|
||||||
|
//
|
||||||
base.ConfigureEntities(modelBuilder);
|
base.ConfigureEntities(modelBuilder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-6
@@ -1,13 +1,16 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<!-- Runtime Definition -->
|
<!-- Runtime Definition -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
|
||||||
<PackageId>xDashboard.xStringService</PackageId>
|
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
|
<LangVersion>12.0</LangVersion>
|
||||||
<Authors>Hadi Khazaee Asl</Authors>
|
<Authors>Hadi Khazaee Asl</Authors>
|
||||||
<Company>SaherElm IT Center</Company>
|
<Company>SaherElm IT Center</Company>
|
||||||
|
<PackageId>xDashboard.xStringService</PackageId>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
|
||||||
<Description>
|
<Description>
|
||||||
it is a Part of xDashboard on SaherElm IT Center which provides String Resources Futures ...
|
it is a Part of xDashboard on SaherElm IT Center which provides String Resources Futures ...
|
||||||
</Description>
|
</Description>
|
||||||
|
|
||||||
<!-- Icon Definition -->
|
<!-- Icon Definition -->
|
||||||
@@ -16,7 +19,8 @@
|
|||||||
|
|
||||||
<!-- Icon Handling -->
|
<!-- Icon Handling -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true" PackagePath="\icon.png" />
|
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||||
|
PackagePath="\icon.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Local Modules -->
|
<!-- Local Modules -->
|
||||||
@@ -25,8 +29,14 @@
|
|||||||
|
|
||||||
<!-- Local Dependencies -->
|
<!-- Local Dependencies -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="../xDataService/xDataService.csproj" />
|
|
||||||
<ProjectReference Include="../xPushService/xPushService.csproj" />
|
<ProjectReference Include="../xPushService/xPushService.csproj" />
|
||||||
<ProjectReference Include="../xIdentityService/xIdentityService.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- For XML Documentation Support -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user