This commit is contained in:
2026-05-16 01:13:57 +03:30
parent 95f5adfc4e
commit 63ddf01a18
16 changed files with 172 additions and 5 deletions
@@ -9,7 +9,7 @@ using xDataService.Interfaces;
using xServices.Interfaces; using xServices.Interfaces;
using xServices.Models.Entities; using xServices.Models.Entities;
namespace xServices.Providers namespace xServices.Controllers
{ {
public partial class XTestRepositoryController : XBaseRepositoryController<XTest, Guid>, IXBaseRepositoryController<XTest, Guid> public partial class XTestRepositoryController : XBaseRepositoryController<XTest, Guid>, IXBaseRepositoryController<XTest, Guid>
{ {
@@ -10,7 +10,7 @@ using xServices.Interfaces;
using xServices.Models.Dtos; using xServices.Models.Dtos;
using xServices.Models.Entities; using xServices.Models.Entities;
namespace xServices.Providers namespace xServices.Controllers
{ {
public class XTestServiceController : XBaseServiceController<XTest, XTestDto, Guid>, IXBaseServiceController<XTest, XTestDto, Guid> public class XTestServiceController : XBaseServiceController<XTest, XTestDto, Guid>, IXBaseServiceController<XTest, XTestDto, Guid>
{ {
+43 -1
View File
@@ -6,7 +6,10 @@ using Microsoft.Extensions.DependencyInjection;
using xCommons.Extensions; using xCommons.Extensions;
using xDataService.DI; using xDataService.DI;
using xDataService.Models; using xDataService.Models;
using xIdentityService.DI;
using xMessageService.DI; using xMessageService.DI;
using xPushService.DI;
using xPushService.Helpers;
using xServices.Configurations; using xServices.Configurations;
using xServices.Constants; using xServices.Constants;
using xServices.Interfaces; using xServices.Interfaces;
@@ -163,6 +166,19 @@ namespace xServices.DI
}); });
} }
#endregion #endregion
//
#region Use Hubs ...
//
var pushHelper = new XPushServiceHelper();
//
pushHelper.AddHub<XTestDtoHub>("testDto");
pushHelper.AddHub<XTestEntityHub>("testEntity");
//
app.UseXPushService(pushHelper);
#endregion
} }
// //
@@ -180,7 +196,7 @@ namespace xServices.DI
IConfiguration configuration, IConfiguration configuration,
XServicesConfiguration config = null, XServicesConfiguration config = null,
IEnumerable<XDatabaseDescriptor> databases = null, IEnumerable<XDatabaseDescriptor> databases = null,
ServiceLifetime lifeTime = ServiceLifetime.Transient ServiceLifetime lifeTime = ServiceLifetime.Scoped
) )
{ {
// //
@@ -198,6 +214,14 @@ namespace xServices.DI
// Message Service ... // Message Service ...
services.AddXMessageService(config: configuration); services.AddXMessageService(config: configuration);
//
#region Register Identity Service ...
// services.AddXIdentityService(
// configuration: configuration,
// lifeTime: ServiceLifetime.Scoped
// );
#endregion
// //
#region Register Data Service ... #region Register Data Service ...
// //
@@ -222,6 +246,24 @@ namespace xServices.DI
// Register Repository Services ... // Register Repository Services ...
services.AddScoped<IXTestRepositoryService, XTestRepositoryService>(); services.AddScoped<IXTestRepositoryService, XTestRepositoryService>();
#endregion #endregion
//
#region Register Push Service ...
//
// Push Service ...
services.AddXPushService(
config: configuration,
lifeTime: ServiceLifetime.Scoped
);
//
// Register Provider Services ...
// since Hubs required Identity Provider, you Have to Register IdentityService as Requirements ...
// a Provider Service, Provides Repository (Entity) or Service (Dto) based
// Data Manipulation Actions by Supporting Hub Contexts Events ...
services.AddScoped<IXTestServiceProvider, XTestServiceProvider>();
services.AddScoped<IXTestRepositoryProvider, XTestRepositoryProvider>();
#endregion
} }
#endregion #endregion
} }
+1
View File
@@ -5,6 +5,7 @@ using xDataService.Interfaces;
using xDataService.Models; using xDataService.Models;
using xServices.Interfaces; using xServices.Interfaces;
using xServices.Models.Entities; using xServices.Models.Entities;
using xServices.Models.GraphQL;
using xServices.Providers; using xServices.Providers;
namespace xServices.Databases namespace xServices.Databases
+10
View File
@@ -0,0 +1,10 @@
using System;
using xPushService.Interfaces;
using xServices.Models.Dtos;
using xServices.Models.Entities;
namespace xServices.Interfaces
{
public interface IXTestDtoHub : IXBaseDtoHub<XTest, XTestDto, Guid>
{ }
}
+9
View File
@@ -0,0 +1,9 @@
using System;
using xPushService.Interfaces;
using xServices.Models.Entities;
namespace xServices.Interfaces
{
public interface IXTestEntityHub : IXBaseEntityHub<XTest, Guid>
{ }
}
+1 -1
View File
@@ -2,7 +2,7 @@ using System;
using GraphQL.Types; using GraphQL.Types;
using xDataService.Interfaces; using xDataService.Interfaces;
using xServices.Models.Entities; using xServices.Models.Entities;
using xServices.Providers; using xServices.Models.GraphQL;
namespace xServices.Interfaces namespace xServices.Interfaces
{ {
+10
View File
@@ -0,0 +1,10 @@
using System;
using xPushService.Interfaces;
using xServices.Models.Entities;
using xServices.Providers;
namespace xServices.Interfaces
{
public interface IXTestRepositoryProvider : IXBaseEntityProviderr<XTest, Guid, XTestEntityHub>
{ }
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using xPushService.Interfaces;
using xServices.Models.Dtos;
using xServices.Models.Entities;
using xServices.Providers;
namespace xServices.Interfaces
{
public interface IXTestServiceProvider : IXBaseDtoProvider<XTest, XTestDto, Guid, XTestDtoHub>
{ }
}
@@ -2,7 +2,7 @@ using System;
using xDataService.GraphQL; using xDataService.GraphQL;
using xServices.Models.Entities; using xServices.Models.Entities;
namespace xServices.Providers namespace xServices.Models.GraphQL
{ {
public class XTestGraphType : XBaseGraphObjectType<XTest, Guid> public class XTestGraphType : XBaseGraphObjectType<XTest, Guid>
{ {
+15
View File
@@ -0,0 +1,15 @@
using System;
using Microsoft.Extensions.Logging;
using xPushService.Base;
using xServices.Interfaces;
using xServices.Models.Dtos;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestDtoHub : XBaseDtoHub<XTest, XTestDto, Guid>, IXTestDtoHub
{
public XTestDtoHub(ILogger<XTestDtoHub> logger) : base(logger)
{ }
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using Microsoft.Extensions.Logging;
using xPushService.Base;
using xServices.Interfaces;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestEntityHub : XBaseEntityHub<XTest, Guid>, IXTestEntityHub
{
public XTestEntityHub(ILogger<XBaseHub> logger) : base(logger)
{ }
}
}
+1
View File
@@ -4,6 +4,7 @@ using xDataService.Configuration;
using xDataService.GraphQL; using xDataService.GraphQL;
using xServices.Interfaces; using xServices.Interfaces;
using xServices.Models.Entities; using xServices.Models.Entities;
using xServices.Models.GraphQL;
namespace xServices.Providers namespace xServices.Providers
{ {
+26
View File
@@ -0,0 +1,26 @@
using System;
using Microsoft.AspNetCore.SignalR;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
using xServices.Interfaces;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestRepositoryProvider : XBaseEntityProvider<XTest, Guid, XTestEntityHub>, IXTestRepositoryProvider
{
public XTestRepositoryProvider(
IXTestRepository repository,
IHubContext<XTestEntityHub> hub,
XDataServiceConfiguration dataConfiguration,
IXIdentityProvider identityProvider = null
) : base(
hub: hub,
repository: repository,
identityProvider: identityProvider,
dataConfiguration: dataConfiguration
)
{ }
}
}
+27
View File
@@ -0,0 +1,27 @@
using System;
using Microsoft.AspNetCore.SignalR;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
using xServices.Interfaces;
using xServices.Models.Dtos;
using xServices.Models.Entities;
namespace xServices.Providers
{
public class XTestServiceProvider : XBaseDtoProvider<XTest, XTestDto, Guid, XTestDtoHub>, IXTestServiceProvider
{
public XTestServiceProvider(
IHubContext<XTestDtoHub> hub,
IXTestRepositoryService service,
XDataServiceConfiguration dataConfiguration,
IXIdentityProvider identityProvider = null
) : base(
hub: hub,
service: service,
identityProvider: identityProvider,
dataConfiguration: dataConfiguration
)
{ }
}
}
+1
View File
@@ -30,6 +30,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\xCommons\xCommons.csproj" /> <ProjectReference Include="..\xCommons\xCommons.csproj" />
<ProjectReference Include="..\xDataService\xDataService.csproj" /> <ProjectReference Include="..\xDataService\xDataService.csproj" />
<ProjectReference Include="..\xPushService\xPushService.csproj" />
<!-- <ProjectReference Include="..\XAiService\XAiService.csproj" /> --> <!-- <ProjectReference Include="..\XAiService\XAiService.csproj" /> -->
<!-- <ProjectReference Include="..\xDataHelper\xDataHelper.csproj" /> --> <!-- <ProjectReference Include="..\xDataHelper\xDataHelper.csproj" /> -->
<!-- <ProjectReference Include="..\xPushHelper\xPushHelper.csproj" /> --> <!-- <ProjectReference Include="..\xPushHelper\xPushHelper.csproj" /> -->