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

This commit is contained in:
2026-07-30 14:27:17 +03:30
parent e37bad59ac
commit 335fd95d23
2 changed files with 12 additions and 7 deletions
+6 -1
View File
@@ -24,7 +24,7 @@ namespace xCategoryService.Constants
public const string XCategoryEntityHub = "categoryEntity"; public const string XCategoryEntityHub = "categoryEntity";
public const string XSubCategoryDtoHub = "subCategoryDto"; public const string XSubCategoryDtoHub = "subCategoryDto";
public const string XSubCategoryEntityHub = "subCategoryEntity"; public const string XSubCategoryEntityHub = "subCategoryEntity";
// //
// Custome Constants ... // Custome Constants ...
public const string SubCategoryReference = "SubCat"; public const string SubCategoryReference = "SubCat";
@@ -32,5 +32,10 @@ namespace xCategoryService.Constants
public const string CategoryDescriptionResourceIdentifier = "CatD"; public const string CategoryDescriptionResourceIdentifier = "CatD";
public const string SubCategoryTitleResourceIdentifier = "SubCatT"; public const string SubCategoryTitleResourceIdentifier = "SubCatT";
public const string SubCategoryDescriptionResourceIdentifier = "SubCatD"; public const string SubCategoryDescriptionResourceIdentifier = "SubCatD";
//
// EF Repositories Helper Extensions ...
public const string GetXCategoryEFRepositoryDescriptor = "GetXCategoryEFRepositoryDescriptor";
public const string GetXSubCategoryEFRepositoryDescriptor = "GetXSubCategoryEFRepositoryDescriptor";
} }
} }
+6 -6
View File
@@ -205,8 +205,8 @@ namespace xCategoryService.DI
// //
// Count Data in Category ... // Count Data in Category ...
var hasCategory = (categoryProvider.Count().GetAwaiter().GetResult()) > 0; var hasCategory = categoryProvider.Count().GetAwaiter().GetResult() > 0;
var hasSubCategory = (subCategoryProvider.Count().GetAwaiter().GetResult()) > 0; var hasSubCategory = subCategoryProvider.Count().GetAwaiter().GetResult() > 0;
// //
// Seed Category Resources ... // Seed Category Resources ...
@@ -370,18 +370,18 @@ namespace xCategoryService.DI
// Category ... // Category ...
categoryDescriptor = typeof(XCategoryServiceHelper) categoryDescriptor = typeof(XCategoryServiceHelper)
.InvokeGenericMethod<XRepositoryDescriptor>( .InvokeGenericMethod<XRepositoryDescriptor>(
methodName: "GetXCategoryEFRepositoryDescriptor", args: null,
runtimeType: contextType, runtimeType: contextType,
args: null methodName: XCategoryServiceConstants.GetXCategoryEFRepositoryDescriptor
); );
// //
// SubCategory ... // SubCategory ...
subCategoryDescriptor = typeof(XCategoryServiceHelper) subCategoryDescriptor = typeof(XCategoryServiceHelper)
.InvokeGenericMethod<XRepositoryDescriptor>( .InvokeGenericMethod<XRepositoryDescriptor>(
methodName: "GetXSubCategoryEFRepositoryDescriptor", args: null,
runtimeType: contextType, runtimeType: contextType,
args: null methodName: XCategoryServiceConstants.GetXSubCategoryEFRepositoryDescriptor
); );
break; break;