Complete SubCategory Data Models and Implementations ...

This commit is contained in:
2026-05-31 00:37:05 +03:30
parent fe08eadcbd
commit a9c2f63b44
36 changed files with 1122 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
using Microsoft.Extensions.Logging;
using xCategoryService.Interfaces.Dtos;
using xCategoryService.Models.Dtos;
using xCategoryService.Models.Entities;
using xPushService.Base;
namespace xCategoryService.Providers.Dtos
{
public class XSubCategoryDtoHub : XBaseDtoHub<XSubCategory, XSubCategoryDto, int>, IXSubCategoryDtoHub
{
public XSubCategoryDtoHub(
ILogger<XSubCategoryDtoHub> logger
) : base(logger)
{ }
}
}
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using AutoMapper;
using xCategoryService.Interfaces.Dtos;
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Dtos;
using xCategoryService.Models.Entities;
using xDataService.Providers;
namespace xCategoryService.Providers.Dtos
{
public class XSubCategoryRepositoryService : XBaseRepositoryService<XSubCategory, XSubCategoryDto, int>, IXSubCategoryRepositoryService
{
public XSubCategoryRepositoryService(
IXSubCategoryRepository repository,
IEnumerable<Profile> mapperProfiles = null
) : base(
repository,
mapperProfiles
)
{ }
}
}
@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.SignalR;
using xCategoryService.Interfaces.Dtos;
using xCategoryService.Models.Dtos;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xCategoryService.Providers.Dtos
{
public class XSubCategoryServiceProvider : XBaseDtoProvider<XSubCategory, XSubCategoryDto, int, XSubCategoryDtoHub>, IXSubCategoryServiceProvider
{
public XSubCategoryServiceProvider(
IHubContext<XSubCategoryDtoHub> hub,
XDataServiceConfiguration dataConfiguration,
IXSubCategoryRepositoryService service,
IXIdentityProvider identityProvider = null
) : base(
hub,
dataConfiguration,
service,
identityProvider
)
{ }
}
}
@@ -0,0 +1,26 @@
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xDataService.Db;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xCategoryService.Providers.Entities
{
public class XSubCategoryEFRepository<TContext> : XBaseEFRepository<XSubCategory, int, TContext>, IXSubCategoryRepository
where TContext : XDbContext
{
public XSubCategoryEFRepository(
IXUnitOfWorks<TContext> unitOfWorks,
XDataServiceConfiguration configuration,
IXSubCategoryKeyGenerator keyGenerator = null,
IXSubCategoryRepositoryEvents baseRepositoryEvents = null
) : base(
unitOfWorks,
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
@@ -0,0 +1,15 @@
using Microsoft.Extensions.Logging;
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xPushService.Base;
namespace xCategoryService.Providers.Entities
{
public class XSubCategoryEntityHub : XBaseEntityHub<XSubCategory, int>, IXSubCategoryEntityHub
{
public XSubCategoryEntityHub(
ILogger<XSubCategoryEntityHub> logger
) : base(logger)
{ }
}
}
@@ -0,0 +1,21 @@
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xCategoryService.Providers.Entities
{
public class XSubCategoryInMemoryRepository : XBaseInMemoryRepository<XSubCategory, int>, IXSubCategoryRepository
{
public XSubCategoryInMemoryRepository(
XDataServiceConfiguration configuration,
IXSubCategoryKeyGenerator keyGenerator = null,
IXSubCategoryRepositoryEvents baseRepositoryEvents = null
) : base(
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
@@ -0,0 +1,9 @@
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Providers;
namespace xCategoryService.Providers.Entities
{
public class XSubCategoryKeyGenerator : XIntKeyGenerator<XSubCategory>, IXSubCategoryKeyGenerator
{ }
}
@@ -0,0 +1,25 @@
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xCategoryService.Providers.Entities
{
public class XSubCategoryMongoRepository : XBaseMongoRepository<XSubCategory, int>, IXSubCategoryRepository
{
public XSubCategoryMongoRepository(
XDataBaseConfiguration dbConfiguration,
XDataServiceConfiguration configuration,
string collectionName = null,
IXSubCategoryKeyGenerator keyGenerator = null,
IXSubCategoryRepositoryEvents baseRepositoryEvents = null
) : base(
dbConfiguration,
configuration,
collectionName,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
@@ -0,0 +1,9 @@
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Providers;
namespace xCategoryService.Providers.Entities
{
public class XSubCategoryRepositoryEvents : XBaseRepositoryEvents<XSubCategory>, IXSubCategoryRepositoryEvents
{ }
}
@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.SignalR;
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xCategoryService.Providers.Entities
{
public class XSubCategoryRepositoryProvider : XBaseEntityProvider<XSubCategory, int, XSubCategoryEntityHub>, IXSubCategoryRepositoryProvider
{
public XSubCategoryRepositoryProvider(
IHubContext<XSubCategoryEntityHub> hub,
IXSubCategoryRepository repository,
XDataServiceConfiguration dataConfiguration,
IXIdentityProvider identityProvider = null
) : base(
hub,
repository,
dataConfiguration,
identityProvider
)
{ }
}
}
@@ -0,0 +1,25 @@
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xDataService.GraphQL;
namespace xCategoryService.Providers.GraphQL
{
public class XSubCategoryGraphQLTypeHelper : XBaseGraphQLTypeHelper<XSubCategory, int>, IXSubCategoryGraphQLTypeHelper
{
public XSubCategoryGraphQLTypeHelper(
XDataServiceConfiguration configuration
) : base(configuration)
{ }
public override string GetInQueryCollectionName()
{
return "subCategories";
}
public override string GetInQuerySingleName()
{
return "subCategory";
}
}
}
@@ -0,0 +1,22 @@
using GraphQL.Types;
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xDataService.GraphQL;
namespace xCategoryService.Providers.GraphQL
{
public class XSubCategoryGraphQuery : XBaseGraphQLQuery<XSubCategory, int, XSubCategoryGraphType, IntGraphType>
{
public XSubCategoryGraphQuery(
XDataServiceConfiguration configuration,
IXSubCategoryRepository repository,
IXSubCategoryGraphQLTypeHelper helper
) : base(
configuration,
repository,
helper
)
{ }
}
}
@@ -0,0 +1,14 @@
using System;
using GraphQL.Types;
namespace xCategoryService.Providers.GraphQL
{
public class XSubCategoryGraphSchema : Schema
{
public XSubCategoryGraphSchema(IServiceProvider services) : base(services)
{
Query = (XSubCategoryGraphQuery)services.GetService(typeof(XSubCategoryGraphQuery));
}
}
}
@@ -0,0 +1,15 @@
using xCategoryService.Models.Entities;
using xDataService.GraphQL;
namespace xCategoryService.Providers.GraphQL
{
public class XSubCategoryGraphType : XBaseGraphObjectType<XSubCategory, int>
{
public XSubCategoryGraphType() : base()
{
Field(x => x.Title);
Field(x => x.Description);
Field(x => x.References);
}
}
}
@@ -0,0 +1,18 @@
using xCategoryService.Interfaces;
using xStringService.Interfaces.Dtos;
using xStringService.Providers;
namespace xCategoryService.Providers
{
public class XSubCategoryDescriptionResourceProvider : XBaseItemResourceProvider, IXSubCategoryDescriptionResourceProvider
{
public XSubCategoryDescriptionResourceProvider(
string item,
IXStringServiceProvider stringProvider
) : base(
item: "SubCatD",
stringProvider
)
{ }
}
}
+27
View File
@@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore;
using xCategoryService.Models.Entities;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xCategoryService.Providers
{
public class XSubCategoryEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
{
public XSubCategoryEntityRegisterar()
: base(nameof(XSubCategoryEntityRegisterar))
{
//
// Add Entity ...
AddEntity<XSubCategory, int>();
}
/// <summary>
/// Configure Entities ...
/// </summary>
/// <param name="modelBuilder"></param>
public override void ConfigureEntities(ModelBuilder modelBuilder)
{
base.ConfigureEntities(modelBuilder);
}
}
}
+24
View File
@@ -0,0 +1,24 @@
using xCategoryService.Interfaces;
using xCategoryService.Interfaces.Entities;
using xCategoryService.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xCategoryService.Providers
{
public abstract class XSubCategorySeederBase : XBaseDbSeeder<XSubCategory, int>, IXSubCategorySeeder
{
protected XSubCategorySeederBase(
string entity,
string database,
IXSubCategoryRepository repository,
XDataServiceConfiguration dataServiceConfiguration
) : base(
entity,
database,
repository,
dataServiceConfiguration
)
{ }
}
}