last works on Implementing XBotUser Entity and Repository Implementation based on xDataService ...

This commit is contained in:
2026-11-11 15:47:44 +03:30
parent 609402b04c
commit 1e2eb030e8
23 changed files with 726 additions and 2 deletions
+16
View File
@@ -0,0 +1,16 @@
using xPushService.Base;
using xBotService.Models.Dtos;
using xBotService.Interfaces.Dtos;
using xBotService.Models.Entities;
using Microsoft.Extensions.Logging;
namespace xBotService.Providers.Dtos
{
public class XBotUserDtoHub : XBaseDtoHub<XBotUser, XBotUserDto, int>, IXBotUserDtoHub
{
public XBotUserDtoHub(
ILogger<XBotUserDtoHub> logger
) : base(logger)
{ }
}
}
+27
View File
@@ -0,0 +1,27 @@
using xPushService.Base;
using xBotService.Models.Dtos;
using xDataService.Configuration;
using xBotService.Interfaces.Dtos;
using xBotService.Models.Entities;
using xIdentityService.Interfaces;
using Microsoft.AspNetCore.SignalR;
using xBotService.Interfaces.Entities.Dtos;
namespace xBotService.Providers.Dtos
{
public class XBotUserServiceProvider : XBaseDtoProvider<XBotUser, XBotUserDto, int, XBotUserDtoHub>, IXBotUserServiceProvider
{
public XBotUserServiceProvider(
IHubContext<XBotUserDtoHub> hub,
XDataServiceConfiguration dataConfiguration,
IXBotUserRepositoryService service,
IXIdentityProvider identityProvider = null
) : base(
hub,
dataConfiguration,
service,
identityProvider
)
{ }
}
}
+15
View File
@@ -0,0 +1,15 @@
using xPushService.Base;
using xBotService.Models.Entities;
using Microsoft.Extensions.Logging;
using xBotService.Interfaces.Entities;
namespace xBotService.Providers.Entities
{
public class XBotUserEntityHub : XBaseEntityHub<XBotUser, int>, IXBotUserEntityHub
{
public XBotUserEntityHub(
ILogger<XBotUserEntityHub> logger
) : base(logger)
{ }
}
}
@@ -0,0 +1,21 @@
using xDataService.Providers;
using xDataService.Configuration;
using xBotService.Models.Entities;
using xBotService.Interfaces.Entities;
namespace xBotService.Providers.Entities
{
public class XBotUserInMemoryRepository : XBaseInMemoryRepository<XBotUser, int>, IXBotUserRepository
{
public XBotUserInMemoryRepository(
XDataServiceConfiguration configuration,
IXBotUserKeyGenerator keyGenerator = null,
IXBotUserRepositoryEvents baseRepositoryEvents = null
) : base(
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
@@ -0,0 +1,25 @@
using xDataService.Providers;
using xDataService.Configuration;
using xBotService.Models.Entities;
using xBotService.Interfaces.Entities;
namespace xBotService.Providers.Entities
{
public class XBotUserMongoRepository : XBaseMongoRepository<XBotUser, int>, IXBotUserRepository
{
public XBotUserMongoRepository(
XDataBaseConfiguration dbConfiguration,
XDataServiceConfiguration configuration,
string collectionName = null,
IXBotUserKeyGenerator keyGenerator = null,
IXBotUserRepositoryEvents baseRepositoryEvents = null
) : base(
dbConfiguration,
configuration,
collectionName,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
+23
View File
@@ -0,0 +1,23 @@
using xDataService.Providers;
using xDataService.Configuration;
using xBotService.Models.Entities;
using xBotService.Interfaces.Entities;
namespace xBotService.Providers.Entities
{
public abstract class XBotUserSeederBase : XBaseDbSeeder<XBotUser, int>, IXBotUserSeeder
{
protected XBotUserSeederBase(
string entity,
string database,
IXBotUserRepository repository,
XDataServiceConfiguration dataServiceConfiguration
) : base(
entity,
database,
repository,
dataServiceConfiguration
)
{ }
}
}
@@ -0,0 +1,28 @@
using xDataService.GraphQL;
using xDataService.Configuration;
using xBotService.Models.Entities;
using xBotService.Interfaces.Entities;
using xBotService.Constants;
namespace xBotService.Providers.GraphQL
{
public class XBotUserGraphQLTypeHelper : XBaseGraphQLTypeHelper<XBotUser, int>, IXBotUserGraphQLTypeHelper
{
public XBotUserGraphQLTypeHelper(
XDataServiceConfiguration configuration
)
: base(configuration)
{
}
public override string GetInQueryCollectionName()
{
return XBotServiceConstants.XBotUserCollectionName;
}
public override string GetInQuerySingleName()
{
return XBotServiceConstants.XBotUserSingleName;
}
}
}
+18
View File
@@ -0,0 +1,18 @@
using GraphQL.Types;
using xDataService.GraphQL;
using xDataService.Configuration;
using xBotService.Models.Entities;
using xBotService.Interfaces.Entities;
namespace xBotService.Providers.GraphQL
{
public class XBotUserGraphQuery : XBaseGraphQLQuery<XBotUser, int, XBotUserGraphType, IntGraphType>
{
public XBotUserGraphQuery(
XDataServiceConfiguration configuration,
IXBotUserRepository repository,
IXBotUserGraphQLTypeHelper helper
) : base(configuration, repository, helper)
{ }
}
}
+13
View File
@@ -0,0 +1,13 @@
using System;
using GraphQL.Types;
namespace xBotService.Providers.GraphQL
{
public class XBotUserGraphSchema : Schema
{
public XBotUserGraphSchema(IServiceProvider services) : base(services)
{
Query = (XBotUserGraphQuery)services.GetService(typeof(XBotUserGraphQuery));
}
}
}
+14
View File
@@ -0,0 +1,14 @@
using xDataService.GraphQL;
using xBotService.Models.Entities;
namespace xBotService.Providers.GraphQL
{
public class XBotUserGraphType : XBaseGraphObjectType<XBotUser, int>
{
public XBotUserGraphType() : base()
{
Field(x => x.UserId);
Field(x => x.BotUserName);
}
}
}
+34
View File
@@ -0,0 +1,34 @@
using xDataService.Providers;
using xDataService.Interfaces;
using xBotService.Models.Entities;
using Microsoft.EntityFrameworkCore;
using xBotService.Configuration.Entities;
namespace xBotService.Providers
{
public class XBotUserEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
{
public XBotUserEntityRegisterar()
: base(nameof(XBotUserEntityRegisterar))
{
//
// Add XBotUser Entity ...
AddEntity<XBotUser, int>();
}
/// <summary>
/// Configure Entities ...
/// </summary>
/// <param name="modelBuilder"></param>
public override void ConfigureEntities(ModelBuilder modelBuilder)
{
//
// Configure Entity Using Provided ...
modelBuilder
.ApplyConfigurationsFromAssembly(typeof(XBotUserEntityConfiguration).Assembly);
//
base.ConfigureEntities(modelBuilder);
}
}
}