Refactor Category Service ...
- Add all HardCoded Strings in Constants ... - Apply Resolve Constant Replacement Side Affects ... - add Support for Service Main Provider ...
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@ namespace xCategoryService.Configurations.Entities
|
|||||||
{
|
{
|
||||||
public override void Configure(EntityTypeBuilder<XCategory> builder)
|
public override void Configure(EntityTypeBuilder<XCategory> builder)
|
||||||
{
|
{
|
||||||
builder.ToTable("Categories");
|
builder.ToTable(XCategoryServiceConstants.XCategoryTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@ namespace xCategoryService.Configurations.Entities
|
|||||||
{
|
{
|
||||||
public override void Configure(EntityTypeBuilder<XSubCategory> builder)
|
public override void Configure(EntityTypeBuilder<XSubCategory> builder)
|
||||||
{
|
{
|
||||||
builder.ToTable("SubCategories");
|
builder.ToTable(XCategoryServiceConstants.XSubCategoryTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,35 @@ namespace xCategoryService.Constants
|
|||||||
{
|
{
|
||||||
public struct XCategoryServiceConstants
|
public struct XCategoryServiceConstants
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Service Extensions Log Tag ...
|
||||||
|
public const string XCategoryServiceDILogTag = "XCategoryService";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Table Mapping Identifiers ...
|
||||||
|
public const string XCategoryTable = "Categories";
|
||||||
|
public const string XSubCategoryTable = "SubCategories";
|
||||||
|
|
||||||
|
//
|
||||||
|
// GraphQL Collection Mappings ...
|
||||||
|
public const string XCategorySingleName = "category";
|
||||||
|
public const string XCategoryCollectionName = "categories";
|
||||||
|
public const string XSubCategorySingleName = "subCategory";
|
||||||
|
public const string XSubCategoryCollectionName = "subCategories";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hubs ...
|
||||||
|
public const string XCategoryDtoHub = "categoryDto";
|
||||||
|
public const string XCategoryEntityHub = "categoryEntity";
|
||||||
|
public const string XSubCategoryDtoHub = "subCategoryDto";
|
||||||
|
public const string XSubCategoryEntityHub = "subCategoryEntity";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custome Constants ...
|
||||||
public const string SubCategoryReference = "SubCat";
|
public const string SubCategoryReference = "SubCat";
|
||||||
|
public const string CategoryTitleResourceIdentifier = "CatT";
|
||||||
|
public const string CategoryDescriptionResourceIdentifier = "CatD";
|
||||||
|
public const string SubCategoryTitleResourceIdentifier = "SubCatT";
|
||||||
|
public const string SubCategoryDescriptionResourceIdentifier = "SubCatD";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using xCategoryService.Configurations;
|
using xCategoryService.Configurations;
|
||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Helpers;
|
using xCategoryService.Helpers;
|
||||||
using xCategoryService.Interfaces;
|
using xCategoryService.Interfaces;
|
||||||
using xCategoryService.Interfaces.Dtos;
|
using xCategoryService.Interfaces.Dtos;
|
||||||
@@ -149,13 +150,13 @@ namespace xCategoryService.DI
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Category ...
|
// Category ...
|
||||||
pushHelper.AddHub<XCategoryDtoHub>("categoryDto");
|
pushHelper.AddHub<XCategoryDtoHub>(XCategoryServiceConstants.XCategoryDtoHub);
|
||||||
pushHelper.AddHub<XCategoryEntityHub>("categoryEntity");
|
pushHelper.AddHub<XCategoryEntityHub>(XCategoryServiceConstants.XCategoryEntityHub);
|
||||||
|
|
||||||
//
|
//
|
||||||
// SubCategory ...
|
// SubCategory ...
|
||||||
pushHelper.AddHub<XSubCategoryDtoHub>("subCategoryDto");
|
pushHelper.AddHub<XSubCategoryDtoHub>(XCategoryServiceConstants.XSubCategoryDtoHub);
|
||||||
pushHelper.AddHub<XSubCategoryEntityHub>("subCategoryEntity");
|
pushHelper.AddHub<XSubCategoryEntityHub>(XCategoryServiceConstants.XSubCategoryEntityHub);
|
||||||
|
|
||||||
//
|
//
|
||||||
app.UseXPushService(pushHelper);
|
app.UseXPushService(pushHelper);
|
||||||
@@ -295,7 +296,7 @@ namespace xCategoryService.DI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a LogTag for Service ...
|
/// a LogTag for Service ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string XLogTag = "XCategoryService";
|
private static string XLogTag = XCategoryServiceConstants.XCategoryServiceDILogTag;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// print a log in Console ...
|
/// print a log in Console ...
|
||||||
@@ -430,7 +431,7 @@ namespace xCategoryService.DI
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Register Services ...
|
#region Register Services ...
|
||||||
//
|
//
|
||||||
#region Category ...
|
#region Category ...
|
||||||
//
|
//
|
||||||
@@ -498,6 +499,12 @@ namespace xCategoryService.DI
|
|||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register Service Main Provider ...
|
||||||
|
services.Add(
|
||||||
|
new ServiceDescriptor(typeof(IXCategoryService), typeof(XCategoryService), lifeTime)
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Log("Service Regitration Succeed ...");
|
Log("Service Regitration Succeed ...");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
|
||||||
namespace xCategoryService.Interfaces
|
namespace xCategoryService.Interfaces.Entities
|
||||||
{
|
{
|
||||||
public interface IXCategorySeeder : IXBaseDbSeeder<XCategory, int>
|
public interface IXCategorySeeder : IXBaseDbSeeder<XCategory, int>
|
||||||
{ }
|
{ }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
|
||||||
namespace xCategoryService.Interfaces
|
namespace xCategoryService.Interfaces.Entities
|
||||||
{
|
{
|
||||||
public interface IXSubCategorySeeder : IXBaseDbSeeder<XSubCategory, int>
|
public interface IXSubCategorySeeder : IXBaseDbSeeder<XSubCategory, int>
|
||||||
{ }
|
{ }
|
||||||
@@ -146,6 +146,7 @@ namespace xCategoryService.Interfaces
|
|||||||
/// Find Many Resource ...
|
/// Find Many Resource ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="predicate"></param>
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XCategoryResourceDto>> FindManyResource(
|
Task<IEnumerable<XCategoryResourceDto>> FindManyResource(
|
||||||
|
|||||||
@@ -0,0 +1,352 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using xCategoryService.Models.Dtos;
|
||||||
|
using xIdentityModels.Models;
|
||||||
|
using xModels.Dtos;
|
||||||
|
|
||||||
|
namespace xCategoryService.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Completely Exported Service ...
|
||||||
|
/// </summary>
|
||||||
|
public interface IXCategoryService
|
||||||
|
{
|
||||||
|
//
|
||||||
|
#region Category Provider ...
|
||||||
|
/// <summary>
|
||||||
|
/// Check Has Specified Locale or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> CategoryHasLocale(
|
||||||
|
int id,
|
||||||
|
string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load an Item by all of it's Related Translations ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XCategoryResourceDto> GetCategoryResource(
|
||||||
|
int id,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XCategoryResourceDto> AddCategory(
|
||||||
|
XCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item by It's Locales ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XCategoryResourceDto> AddCategoryResource(
|
||||||
|
XCategoryResourceDto item,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language">if null, Remove All</param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XCategoryResourceDto> RemoveCategory(
|
||||||
|
int id,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update an Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XCategoryResourceDto> UpdateCategory(
|
||||||
|
int id,
|
||||||
|
XCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh a Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XCategoryResourceDto> RefreshCategory(
|
||||||
|
XCategoryResourceDto resource,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XCategoryResourceDto>> GetAllCategoryResources(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find One Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XCategoryResourceDto> FindOneCategoryResource(
|
||||||
|
Expression<Func<XCategoryResourceDto, bool>> predicate = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find Many Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XCategoryResourceDto>> FindManyCategoryResource(
|
||||||
|
Expression<Func<XCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XCategoryResourceDto>, IOrderedQueryable<XCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Resources by Query Pattern ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XQueryResult<XCategoryResourceDto>> QueryCategoryResources(
|
||||||
|
XQuery query = null,
|
||||||
|
Expression<Func<XCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XCategoryResourceDto>, IOrderedQueryable<XCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources as Async Enumerable ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IAsyncEnumerable<XCategoryResourceDto> GetAllCategoryResourcesAsAsyncEnumerable(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region SubCategory Provider ...
|
||||||
|
/// <summary>
|
||||||
|
/// Check Has Specified Locale or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> SubCategoryHasLocale(
|
||||||
|
int id,
|
||||||
|
string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load an Item by all of it's Related Translations ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XSubCategoryResourceDto> GetSubCategoryResource(
|
||||||
|
int id,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XSubCategoryResourceDto> AddSubCategory(
|
||||||
|
XSubCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item by it's Locales and Reference ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XSubCategoryResourceDto> AddSubCategoryResource(
|
||||||
|
XSubCategoryResourceDto item,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language">if null, Remove All</param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XSubCategoryResourceDto> RemoveSubCategory(
|
||||||
|
int id,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update an Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XSubCategoryResourceDto> UpdateSubCategory(
|
||||||
|
int id,
|
||||||
|
XSubCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh a Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XSubCategoryResourceDto> RefreshSubCategory(
|
||||||
|
XSubCategoryResourceDto resource,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XSubCategoryResourceDto>> GetAllSubCategoryResources(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find One Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XSubCategoryResourceDto> FindOneSubCategoryResource(
|
||||||
|
Expression<Func<XSubCategoryResourceDto, bool>> predicate = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find Many Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XSubCategoryResourceDto>> FindManySubCategoryResource(
|
||||||
|
Expression<Func<XSubCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XSubCategoryResourceDto>, IOrderedQueryable<XSubCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Resources by Query Pattern ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XQueryResult<XSubCategoryResourceDto>> QuerySubCategoryResources(
|
||||||
|
XQuery query = null,
|
||||||
|
Expression<Func<XSubCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XSubCategoryResourceDto>, IOrderedQueryable<XSubCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources as Async Enumerable ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IAsyncEnumerable<XSubCategoryResourceDto> GetAllSubCategoryResourcesAsAsyncEnumerable(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -146,6 +146,7 @@ namespace xCategoryService.Interfaces
|
|||||||
/// Find Many Resource ...
|
/// Find Many Resource ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="predicate"></param>
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XSubCategoryResourceDto>> FindManyResource(
|
Task<IEnumerable<XSubCategoryResourceDto>> FindManyResource(
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using xCategoryService.Interfaces;
|
|
||||||
using xCategoryService.Interfaces.Entities;
|
using xCategoryService.Interfaces.Entities;
|
||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
|
||||||
namespace xCategoryService.Providers
|
namespace xCategoryService.Providers.Entities
|
||||||
{
|
{
|
||||||
public abstract class XCategorySeederBase : XBaseDbSeeder<XCategory, int>, IXCategorySeeder
|
public abstract class XCategorySeederBase : XBaseDbSeeder<XCategory, int>, IXCategorySeeder
|
||||||
{
|
{
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
using xCategoryService.Interfaces;
|
|
||||||
using xCategoryService.Interfaces.Entities;
|
using xCategoryService.Interfaces.Entities;
|
||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
|
||||||
namespace xCategoryService.Providers
|
namespace xCategoryService.Providers.Entities
|
||||||
{
|
{
|
||||||
public abstract class XSubCategorySeederBase : XBaseDbSeeder<XSubCategory, int>, IXSubCategorySeeder
|
public abstract class XSubCategorySeederBase : XBaseDbSeeder<XSubCategory, int>, IXSubCategorySeeder
|
||||||
{
|
{
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Interfaces.Entities;
|
using xCategoryService.Interfaces.Entities;
|
||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
@@ -14,12 +15,12 @@ namespace xCategoryService.Providers.GraphQL
|
|||||||
|
|
||||||
public override string GetInQueryCollectionName()
|
public override string GetInQueryCollectionName()
|
||||||
{
|
{
|
||||||
return "categories";
|
return XCategoryServiceConstants.XCategoryCollectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetInQuerySingleName()
|
public override string GetInQuerySingleName()
|
||||||
{
|
{
|
||||||
return "category";
|
return XCategoryServiceConstants.XCategorySingleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Interfaces.Entities;
|
using xCategoryService.Interfaces.Entities;
|
||||||
using xCategoryService.Models.Entities;
|
using xCategoryService.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
@@ -14,12 +15,12 @@ namespace xCategoryService.Providers.GraphQL
|
|||||||
|
|
||||||
public override string GetInQueryCollectionName()
|
public override string GetInQueryCollectionName()
|
||||||
{
|
{
|
||||||
return "subCategories";
|
return XCategoryServiceConstants.XSubCategoryCollectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetInQuerySingleName()
|
public override string GetInQuerySingleName()
|
||||||
{
|
{
|
||||||
return "subCategory";
|
return XCategoryServiceConstants.XSubCategorySingleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Interfaces;
|
using xCategoryService.Interfaces;
|
||||||
using xStringService.Interfaces.Dtos;
|
using xStringService.Interfaces.Dtos;
|
||||||
using xStringService.Providers;
|
using xStringService.Providers;
|
||||||
@@ -9,8 +10,8 @@ namespace xCategoryService.Providers
|
|||||||
public XCategoryDescriptionResourceProvider(
|
public XCategoryDescriptionResourceProvider(
|
||||||
IXStringServiceProvider stringProvider
|
IXStringServiceProvider stringProvider
|
||||||
) : base(
|
) : base(
|
||||||
item: "CatD",
|
stringProvider: stringProvider,
|
||||||
stringProvider
|
item: XCategoryServiceConstants.CategoryDescriptionResourceIdentifier
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1231,6 +1231,7 @@ namespace xCategoryService.Providers
|
|||||||
/// Find Many Resource ...
|
/// Find Many Resource ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="predicate"></param>
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IEnumerable<XCategoryResourceDto>> FindManyResource(
|
public async Task<IEnumerable<XCategoryResourceDto>> FindManyResource(
|
||||||
|
|||||||
@@ -0,0 +1,589 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using xCategoryService.Interfaces;
|
||||||
|
using xCategoryService.Models.Dtos;
|
||||||
|
using xIdentityModels.Models;
|
||||||
|
using xModels.Dtos;
|
||||||
|
|
||||||
|
namespace xCategoryService.Providers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Completely Exported Service ...
|
||||||
|
/// </summary>
|
||||||
|
public class XCategoryService : IXCategoryService
|
||||||
|
{
|
||||||
|
private readonly IXCategoryProvider categoryProvider;
|
||||||
|
private readonly IXSubCategoryProvider subCategoryProvider;
|
||||||
|
|
||||||
|
public XCategoryService(
|
||||||
|
IXCategoryProvider categoryProvider,
|
||||||
|
IXSubCategoryProvider subCategoryProvider
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.categoryProvider = categoryProvider;
|
||||||
|
this.subCategoryProvider = subCategoryProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Category Provider ...
|
||||||
|
/// <summary>
|
||||||
|
/// Check Has Specified Locale or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> CategoryHasLocale(
|
||||||
|
int id,
|
||||||
|
string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.HasLocale(
|
||||||
|
id: id,
|
||||||
|
language: language,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load an Item by all of it's Related Translations ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XCategoryResourceDto> GetCategoryResource(
|
||||||
|
int id,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.GetResource(
|
||||||
|
id: id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XCategoryResourceDto> AddCategory(
|
||||||
|
XCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.Add(
|
||||||
|
item: item,
|
||||||
|
language: language,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item by It's Locales ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XCategoryResourceDto> AddCategoryResource(
|
||||||
|
XCategoryResourceDto item,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.AddResource(
|
||||||
|
item: item,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language">if null, Remove All</param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XCategoryResourceDto> RemoveCategory(
|
||||||
|
int id,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.Remove(
|
||||||
|
id: id,
|
||||||
|
language: language,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update an Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XCategoryResourceDto> UpdateCategory(
|
||||||
|
int id,
|
||||||
|
XCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.Update(
|
||||||
|
id: id,
|
||||||
|
item: item,
|
||||||
|
language: language,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh a Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XCategoryResourceDto> RefreshCategory(
|
||||||
|
XCategoryResourceDto resource,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.Refresh(
|
||||||
|
resource: resource,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XCategoryResourceDto>> GetAllCategoryResources(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.GetAllResources(
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find One Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XCategoryResourceDto> FindOneCategoryResource(
|
||||||
|
Expression<Func<XCategoryResourceDto, bool>> predicate = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.FindOneResource(
|
||||||
|
predicate: predicate,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find Many Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XCategoryResourceDto>> FindManyCategoryResource(
|
||||||
|
Expression<Func<XCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XCategoryResourceDto>, IOrderedQueryable<XCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.FindManyResource(
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Resources by Query Pattern ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XQueryResult<XCategoryResourceDto>> QueryCategoryResources(
|
||||||
|
XQuery query = null,
|
||||||
|
Expression<Func<XCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XCategoryResourceDto>, IOrderedQueryable<XCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await categoryProvider
|
||||||
|
.QueryResources(
|
||||||
|
query: query,
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources as Async Enumerable ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual IAsyncEnumerable<XCategoryResourceDto> GetAllCategoryResourcesAsAsyncEnumerable(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return categoryProvider
|
||||||
|
.GetAllResourcesAsAsyncEnumerable(
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region SubCategory Provider ...
|
||||||
|
/// <summary>
|
||||||
|
/// Check Has Specified Locale or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> SubCategoryHasLocale(
|
||||||
|
int id,
|
||||||
|
string language,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.HasLocale(
|
||||||
|
id: id,
|
||||||
|
language: language,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load an Item by all of it's Related Translations ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XSubCategoryResourceDto> GetSubCategoryResource(
|
||||||
|
int id,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.GetResource(
|
||||||
|
id: id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XSubCategoryResourceDto> AddSubCategory(
|
||||||
|
XSubCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.Add(
|
||||||
|
item: item,
|
||||||
|
language: language,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Item by it's Locales and Reference ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XSubCategoryResourceDto> AddSubCategoryResource(
|
||||||
|
XSubCategoryResourceDto item,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.AddResource(
|
||||||
|
item: item,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="language">if null, Remove All</param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XSubCategoryResourceDto> RemoveSubCategory(
|
||||||
|
int id,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.Remove(
|
||||||
|
id: id,
|
||||||
|
language: language,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update an Item for Specified Language ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="language"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XSubCategoryResourceDto> UpdateSubCategory(
|
||||||
|
int id,
|
||||||
|
XSubCategoryDto item,
|
||||||
|
string language = null,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.Update(
|
||||||
|
id: id,
|
||||||
|
item: item,
|
||||||
|
language: language,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh a Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resource"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XSubCategoryResourceDto> RefreshSubCategory(
|
||||||
|
XSubCategoryResourceDto resource,
|
||||||
|
string connectionId = null,
|
||||||
|
XUserClaimsInfoDto userInfo = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.Refresh(
|
||||||
|
resource: resource,
|
||||||
|
userInfo: userInfo,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XSubCategoryResourceDto>> GetAllSubCategoryResources(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.GetAllResources(
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find One Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XSubCategoryResourceDto> FindOneSubCategoryResource(
|
||||||
|
Expression<Func<XSubCategoryResourceDto, bool>> predicate = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.FindOneResource(
|
||||||
|
predicate: predicate,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find Many Resource ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XSubCategoryResourceDto>> FindManySubCategoryResource(
|
||||||
|
Expression<Func<XSubCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XSubCategoryResourceDto>, IOrderedQueryable<XSubCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.FindManyResource(
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Resources by Query Pattern ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XQueryResult<XSubCategoryResourceDto>> QuerySubCategoryResources(
|
||||||
|
XQuery query = null,
|
||||||
|
Expression<Func<XSubCategoryResourceDto, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XSubCategoryResourceDto>, IOrderedQueryable<XSubCategoryResourceDto>> orderBuilder = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return await subCategoryProvider
|
||||||
|
.QueryResources(
|
||||||
|
query: query,
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get All Resources as Async Enumerable ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual IAsyncEnumerable<XSubCategoryResourceDto> GetAllSubCategoryResourcesAsAsyncEnumerable(
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return subCategoryProvider
|
||||||
|
.GetAllResourcesAsAsyncEnumerable(
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace xCategoryService.Providers
|
|
||||||
{
|
|
||||||
public class XCategoryServiceSeeder
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Interfaces;
|
using xCategoryService.Interfaces;
|
||||||
using xStringService.Interfaces.Dtos;
|
using xStringService.Interfaces.Dtos;
|
||||||
using xStringService.Providers;
|
using xStringService.Providers;
|
||||||
@@ -9,8 +10,8 @@ namespace xCategoryService.Providers
|
|||||||
public XCategoryTitleResourceProvider(
|
public XCategoryTitleResourceProvider(
|
||||||
IXStringServiceProvider stringProvider
|
IXStringServiceProvider stringProvider
|
||||||
) : base(
|
) : base(
|
||||||
item: "CatT",
|
stringProvider: stringProvider,
|
||||||
stringProvider
|
item: XCategoryServiceConstants.CategoryTitleResourceIdentifier
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Interfaces;
|
using xCategoryService.Interfaces;
|
||||||
using xStringService.Interfaces.Dtos;
|
using xStringService.Interfaces.Dtos;
|
||||||
using xStringService.Providers;
|
using xStringService.Providers;
|
||||||
@@ -9,8 +10,8 @@ namespace xCategoryService.Providers
|
|||||||
public XSubCategoryDescriptionResourceProvider(
|
public XSubCategoryDescriptionResourceProvider(
|
||||||
IXStringServiceProvider stringProvider
|
IXStringServiceProvider stringProvider
|
||||||
) : base(
|
) : base(
|
||||||
item: "SubCatD",
|
stringProvider: stringProvider,
|
||||||
stringProvider
|
item: XCategoryServiceConstants.SubCategoryDescriptionResourceIdentifier
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1322,6 +1322,7 @@ namespace xCategoryService.Providers
|
|||||||
/// Find Many Resource ...
|
/// Find Many Resource ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="predicate"></param>
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IEnumerable<XSubCategoryResourceDto>> FindManyResource(
|
public async Task<IEnumerable<XSubCategoryResourceDto>> FindManyResource(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using xCategoryService.Constants;
|
||||||
using xCategoryService.Interfaces;
|
using xCategoryService.Interfaces;
|
||||||
using xStringService.Interfaces.Dtos;
|
using xStringService.Interfaces.Dtos;
|
||||||
using xStringService.Providers;
|
using xStringService.Providers;
|
||||||
@@ -9,8 +10,8 @@ namespace xCategoryService.Providers
|
|||||||
public XSubCategoryTitleResourceProvider(
|
public XSubCategoryTitleResourceProvider(
|
||||||
IXStringServiceProvider stringProvider
|
IXStringServiceProvider stringProvider
|
||||||
) : base(
|
) : base(
|
||||||
item: "SubCatT",
|
stringProvider: stringProvider,
|
||||||
stringProvider
|
item: XCategoryServiceConstants.SubCategoryTitleResourceIdentifier
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user