refactor and add using constants instead of hard coded strings ...
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xFileService.Constants;
|
||||||
using xFileService.Models.Entities;
|
using xFileService.Models.Entities;
|
||||||
|
|
||||||
namespace xFileService.Configurations.Entities
|
namespace xFileService.Configurations.Entities
|
||||||
@@ -10,7 +11,7 @@ namespace xFileService.Configurations.Entities
|
|||||||
{
|
{
|
||||||
public override void Configure(EntityTypeBuilder<XFile> builder)
|
public override void Configure(EntityTypeBuilder<XFile> builder)
|
||||||
{
|
{
|
||||||
builder.ToTable("Files");
|
builder.ToTable(XFileServiceConstants.XFileTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using xFileService.Models.Entities;
|
||||||
|
|
||||||
|
namespace xFileService.Constants
|
||||||
|
{
|
||||||
|
public struct XFileServiceConstants
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Service Extensions Log Tag ...
|
||||||
|
public const string XFileServiceDILogTag = "XFileService";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Table Mapping Identifiers ...
|
||||||
|
public const string XFileTable = "Files";
|
||||||
|
|
||||||
|
//
|
||||||
|
// GraphQL Collection Mappings ...
|
||||||
|
public const string XFileSingleName = "file";
|
||||||
|
public const string XFileCollectionName = "files";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hubs ...
|
||||||
|
public const string XFileDtoHub = "fileDto";
|
||||||
|
public const string XFileEntityHub = "fileEntity";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custome Constants ...
|
||||||
|
public const string XFileTagProvided = nameof(XFile);
|
||||||
|
|
||||||
|
//
|
||||||
|
// EF Repositories Helper Extensions ...
|
||||||
|
public const string GetXFileEFRepositoryDescriptor = "GetXFileEFRepositoryDescriptor";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ using xFileService.Providers.Dtos;
|
|||||||
using xFileService.Providers.Entities;
|
using xFileService.Providers.Entities;
|
||||||
using xFileService.Interfaces;
|
using xFileService.Interfaces;
|
||||||
using xFileService.Providers;
|
using xFileService.Providers;
|
||||||
|
using xFileService.Constants;
|
||||||
|
|
||||||
namespace xFileService.DI
|
namespace xFileService.DI
|
||||||
{
|
{
|
||||||
@@ -80,8 +81,8 @@ namespace xFileService.DI
|
|||||||
var pushHelper = new XPushServiceHelper();
|
var pushHelper = new XPushServiceHelper();
|
||||||
|
|
||||||
//
|
//
|
||||||
pushHelper.AddHub<XFileDtoHub>("fileDto");
|
pushHelper.AddHub<XFileDtoHub>(XFileServiceConstants.XFileDtoHub);
|
||||||
pushHelper.AddHub<XFileEntityHub>("fileEntity");
|
pushHelper.AddHub<XFileEntityHub>(XFileServiceConstants.XFileEntityHub);
|
||||||
|
|
||||||
//
|
//
|
||||||
app.UseXPushService(pushHelper);
|
app.UseXPushService(pushHelper);
|
||||||
@@ -106,7 +107,7 @@ namespace xFileService.DI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a LogTag for Service ...
|
/// a LogTag for Service ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string XLogTag = "XFileService";
|
private static string XLogTag = XFileServiceConstants.XFileServiceDILogTag;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// print a log in Console ...
|
/// print a log in Console ...
|
||||||
@@ -179,9 +180,9 @@ namespace xFileService.DI
|
|||||||
//
|
//
|
||||||
descriptor = typeof(XFileServiceHelper)
|
descriptor = typeof(XFileServiceHelper)
|
||||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||||
methodName: "GetXFileEFRepositoryDescriptor",
|
args: null,
|
||||||
runtimeType: contextType,
|
runtimeType: contextType,
|
||||||
args: null
|
methodName: XFileServiceConstants.GetXFileEFRepositoryDescriptor
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using System;
|
|||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
using xFileService.Models.Entities;
|
using xFileService.Models.Entities;
|
||||||
|
|
||||||
namespace xFileService.Interfaces
|
namespace xFileService.Interfaces.Entities
|
||||||
{
|
{
|
||||||
public interface IXFileSeeder : IXBaseDbSeeder<XFile, Guid>
|
public interface IXFileSeeder : IXBaseDbSeeder<XFile, Guid>
|
||||||
{ }
|
{ }
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
using xFileService.Interfaces;
|
|
||||||
using xFileService.Interfaces.Entities;
|
using xFileService.Interfaces.Entities;
|
||||||
using xFileService.Models.Entities;
|
using xFileService.Models.Entities;
|
||||||
|
|
||||||
namespace xFileService.Providers
|
namespace xFileService.Providers.Entities
|
||||||
{
|
{
|
||||||
public abstract class XFileSeederBase : XBaseDbSeeder<XFile, Guid>, IXFileSeeder
|
public abstract class XFileSeederBase : XBaseDbSeeder<XFile, Guid>, IXFileSeeder
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xFileService.Constants;
|
||||||
using xFileService.Interfaces.Entities;
|
using xFileService.Interfaces.Entities;
|
||||||
using xFileService.Models.Entities;
|
using xFileService.Models.Entities;
|
||||||
|
|
||||||
@@ -15,12 +16,12 @@ namespace xFileService.Providers.GraphQL
|
|||||||
|
|
||||||
public override string GetInQueryCollectionName()
|
public override string GetInQueryCollectionName()
|
||||||
{
|
{
|
||||||
return "files";
|
return XFileServiceConstants.XFileCollectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetInQuerySingleName()
|
public override string GetInQuerySingleName()
|
||||||
{
|
{
|
||||||
return "file";
|
return XFileServiceConstants.XFileSingleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xFileService.Constants;
|
||||||
using xFileService.Interfaces;
|
using xFileService.Interfaces;
|
||||||
using xFileService.Models.Entities;
|
|
||||||
using xTagService.Interfaces.Dtos;
|
using xTagService.Interfaces.Dtos;
|
||||||
using xTagService.Providers;
|
using xTagService.Providers;
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@ namespace xFileService.Providers
|
|||||||
public XFileTagProvider(
|
public XFileTagProvider(
|
||||||
IXTagServiceProvider tagProvider
|
IXTagServiceProvider tagProvider
|
||||||
) : base(
|
) : base(
|
||||||
providedFor: nameof(XFile),
|
tagProvider: tagProvider,
|
||||||
tagProvider: tagProvider
|
providedFor: XFileServiceConstants.XFileTagProvided
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user