refactor and add using constants instead of hard coded strings ...
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xStringService.Constants;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
namespace xStringService.Configurations.Entities
|
namespace xStringService.Configurations.Entities
|
||||||
@@ -9,7 +10,7 @@ namespace xStringService.Configurations.Entities
|
|||||||
{
|
{
|
||||||
public override void Configure(EntityTypeBuilder<XString> builder)
|
public override void Configure(EntityTypeBuilder<XString> builder)
|
||||||
{
|
{
|
||||||
builder.ToTable("Strings");
|
builder.ToTable(XStringServiceConstants.XStringTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
namespace xStringService.Constants
|
||||||
|
{
|
||||||
|
public struct XStringServiceConstants
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Service Extensions Log Tag ...
|
||||||
|
public const string XStringServiceDILogTag = "XStringService";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Table Mapping Identifiers ...
|
||||||
|
public const string XStringTable = "Strings";
|
||||||
|
|
||||||
|
//
|
||||||
|
// GraphQL Collection Mappings ...
|
||||||
|
public const string XStringSingleName = "string";
|
||||||
|
public const string XStringCollectionName = "strings";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hubs ...
|
||||||
|
public const string XStringDtoHub = "stringDto";
|
||||||
|
public const string XStringEntityHub = "stringEntity";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custome Constants ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// EF Repositories Helper Extensions ...
|
||||||
|
public const string GetXStringEFRepositoryDescriptor = "GetXStringEFRepositoryDescriptor";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ using xPushService.Helpers;
|
|||||||
using xPushService.DI;
|
using xPushService.DI;
|
||||||
using xStringService.Interfaces;
|
using xStringService.Interfaces;
|
||||||
using xStringService.Providers;
|
using xStringService.Providers;
|
||||||
|
using xStringService.Constants;
|
||||||
|
|
||||||
namespace xStringService.DI
|
namespace xStringService.DI
|
||||||
{
|
{
|
||||||
@@ -80,8 +81,8 @@ namespace xStringService.DI
|
|||||||
var pushHelper = new XPushServiceHelper();
|
var pushHelper = new XPushServiceHelper();
|
||||||
|
|
||||||
//
|
//
|
||||||
pushHelper.AddHub<XStringDtoHub>("stringDto");
|
pushHelper.AddHub<XStringDtoHub>(XStringServiceConstants.XStringDtoHub);
|
||||||
pushHelper.AddHub<XStringEntityHub>("stringEntity");
|
pushHelper.AddHub<XStringEntityHub>(XStringServiceConstants.XStringEntityHub);
|
||||||
|
|
||||||
//
|
//
|
||||||
app.UseXPushService(pushHelper);
|
app.UseXPushService(pushHelper);
|
||||||
@@ -106,7 +107,7 @@ namespace xStringService.DI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a LogTag for Service ...
|
/// a LogTag for Service ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string XLogTag = "XStringService";
|
private static string XLogTag = XStringServiceConstants.XStringServiceDILogTag;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// print a log in Console ...
|
/// print a log in Console ...
|
||||||
@@ -179,9 +180,9 @@ namespace xStringService.DI
|
|||||||
//
|
//
|
||||||
descriptor = typeof(XStringServiceHelper)
|
descriptor = typeof(XStringServiceHelper)
|
||||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||||
methodName: "GetXStringEFRepositoryDescriptor",
|
args: null,
|
||||||
runtimeType: contextType,
|
runtimeType: contextType,
|
||||||
args: null
|
methodName: XStringServiceConstants.GetXStringEFRepositoryDescriptor
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
namespace xStringService.Interfaces
|
namespace xStringService.Interfaces.Entities
|
||||||
{
|
{
|
||||||
public interface IXStringSeeder : IXBaseDbSeeder<XString, int>
|
public interface IXStringSeeder : IXBaseDbSeeder<XString, int>
|
||||||
{}
|
{}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
using xStringService.Interfaces;
|
|
||||||
using xStringService.Interfaces.Entities;
|
using xStringService.Interfaces.Entities;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
namespace xStringService.Providers
|
namespace xStringService.Providers.Entities
|
||||||
{
|
{
|
||||||
public abstract class XStringSeederBase : XBaseDbSeeder<XString, int>, IXStringSeeder
|
public abstract class XStringSeederBase : XBaseDbSeeder<XString, int>, IXStringSeeder
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xStringService.Constants;
|
||||||
using xStringService.Interfaces.Entities;
|
using xStringService.Interfaces.Entities;
|
||||||
using xStringService.Models.Entities;
|
using xStringService.Models.Entities;
|
||||||
|
|
||||||
@@ -14,12 +15,12 @@ namespace xStringService.Providers.GraphQL
|
|||||||
|
|
||||||
public override string GetInQueryCollectionName()
|
public override string GetInQueryCollectionName()
|
||||||
{
|
{
|
||||||
return "strings";
|
return XStringServiceConstants.XStringCollectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetInQuerySingleName()
|
public override string GetInQuerySingleName()
|
||||||
{
|
{
|
||||||
return "string";
|
return XStringServiceConstants.XStringSingleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user