refactor and add using constants instead of hard coded strings ...

This commit is contained in:
2026-07-30 14:25:38 +03:30
parent 33b4efde94
commit 7823dffcfa
5 changed files with 41 additions and 10 deletions
+30
View File
@@ -0,0 +1,30 @@
namespace xTagService.Constants
{
public struct XTagServiceConstants
{
//
// Service Extensions Log Tag ...
public const string XTagServiceDILogTag = "XTagService";
//
// Table Mapping Identifiers ...
public const string XTagTable = "Tags";
//
// GraphQL Collection Mappings ...
public const string XTagSingleName = "tag";
public const string XTagCollectionName = "tags";
//
// Hubs ...
public const string XTagDtoHub = "tagDto";
public const string XTagEntityHub = "tagEntity";
//
// Custome Constants ...
//
// EF Repositories Helper Extensions ...
public const string GetXTagEFRepositoryDescriptor = "GetXTagEFRepositoryDescriptor";
}
}
+6 -5
View File
@@ -10,6 +10,7 @@ using xDataService.Models;
using xExceptions.Constants;
using xPushService.DI;
using xPushService.Helpers;
using xTagService.Constants;
using xTagService.Helpers;
using xTagService.Interfaces;
using xTagService.Interfaces.Dtos;
@@ -80,8 +81,8 @@ namespace xTagService.DI
var pushHelper = new XPushServiceHelper();
//
pushHelper.AddHub<XTagDtoHub>("tagDto");
pushHelper.AddHub<XTagEntityHub>("tagEntity");
pushHelper.AddHub<XTagDtoHub>(XTagServiceConstants.XTagDtoHub);
pushHelper.AddHub<XTagEntityHub>(XTagServiceConstants.XTagEntityHub);
//
app.UseXPushService(pushHelper);
@@ -106,7 +107,7 @@ namespace xTagService.DI
/// <summary>
/// a LogTag for Service ...
/// </summary>
private static string XLogTag = "XTagService";
private static string XLogTag = XTagServiceConstants.XTagServiceDILogTag;
/// <summary>
/// print a log in Console ...
@@ -179,9 +180,9 @@ namespace xTagService.DI
//
descriptor = typeof(XTagServiceHelper)
.InvokeGenericMethod<XRepositoryDescriptor>(
methodName: "GetXTagEFRepositoryDescriptor",
args: null,
runtimeType: contextType,
args: null
methodName: XTagServiceConstants.GetXTagEFRepositoryDescriptor
);
break;
@@ -1,7 +1,7 @@
using xDataService.Interfaces;
using xTagService.Models.Entities;
namespace xTagService.Interfaces
namespace xTagService.Interfaces.Entities
{
public interface IXTagSeeder : IXBaseDbSeeder<XTag, int>
{ }
@@ -1,10 +1,9 @@
using xDataService.Configuration;
using xDataService.Providers;
using xTagService.Interfaces;
using xTagService.Interfaces.Entities;
using xTagService.Models.Entities;
namespace xTagService.Providers
namespace xTagService.Providers.Entities
{
public abstract class XTagSeederBase : XBaseDbSeeder<XTag, int>, IXTagSeeder
{
+3 -2
View File
@@ -1,5 +1,6 @@
using xDataService.Configuration;
using xDataService.GraphQL;
using xTagService.Constants;
using xTagService.Interfaces.Entities;
using xTagService.Models.Entities;
@@ -14,12 +15,12 @@ namespace xTagService.Providers.GraphQL
public override string GetInQueryCollectionName()
{
return "tags";
return XTagServiceConstants.XTagCollectionName;
}
public override string GetInQuerySingleName()
{
return "tag";
return XTagServiceConstants.XTagSingleName;
}
}
}