Expose entity type full name to more templates

This commit is contained in:
Wvader 2022-12-27 10:41:41 +00:00
parent c351b13aac
commit 91c4d350e1
7 changed files with 14 additions and 6 deletions

View File

@ -12,8 +12,8 @@ namespace BlueWest.EfMethods
var createTypeFullName = model.CreateTypeFullName; var createTypeFullName = model.CreateTypeFullName;
var newEntityVarName = $"new{model.EntityTypeIdentifierName}"; var newEntityVarName = $"new{model.EntityTypeIdentifierName}";
var toCreateVarName = $"{model.EntityTypeIdentifierName.ToCamelCase()}ToCreate"; var toCreateVarName = $"{model.EntityTypeIdentifierName.ToCamelCase()}ToCreate";
var entityTypeName = model.EntityTypeIdentifierName; var entityTypeName = model.EntityTypeIdentifierName;
var entityFullTypeName = model.EntityTypeFullName;
var contextFullName = methodsModel.ContextFullType; var contextFullName = methodsModel.ContextFullType;
var propertyName = model.PropertyName; var propertyName = model.PropertyName;
@ -22,6 +22,7 @@ namespace BlueWest.EfMethods
var templateToSourceBuilder = new StringBuilder(addSourceTemplate); var templateToSourceBuilder = new StringBuilder(addSourceTemplate);
templateToSourceBuilder templateToSourceBuilder
.Replace("{entityTypeName}", model.EntityTypeIdentifierName) .Replace("{entityTypeName}", model.EntityTypeIdentifierName)
.Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{returnTypeFullName}", returnTypeFullName) .Replace("{returnTypeFullName}", returnTypeFullName)
.Replace("{createTypeFullName}", createTypeFullName) .Replace("{createTypeFullName}", createTypeFullName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)

View File

@ -15,7 +15,7 @@ namespace BlueWest.EfMethods
var listItemCreateVarName = model.ListEntityIdentifierName.ToCamelCase() + "toCreate"; var listItemCreateVarName = model.ListEntityIdentifierName.ToCamelCase() + "toCreate";
var listEntityTypeName = model.ListEntityIdentifierName; var listEntityTypeName = model.ListEntityIdentifierName;
var listEntityFullName = model.ListEntityFullTypeName; var listEntityFullName = model.ListEntityFullTypeName;
var entityFullTypeName = model.EntityTypeFullName;
var contextFullName = methodsModel.ContextFullType; var contextFullName = methodsModel.ContextFullType;
var propertyName = model.PropertyName; var propertyName = model.PropertyName;
var primaryKeyFullName = model.KeyFullTypeName; var primaryKeyFullName = model.KeyFullTypeName;
@ -31,6 +31,7 @@ namespace BlueWest.EfMethods
.Replace("{returnTypeFullName}", returnTypeFullName) .Replace("{returnTypeFullName}", returnTypeFullName)
.Replace("{entityTypeName}", entityTypeName) .Replace("{entityTypeName}", entityTypeName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{listPropertyName}", listPropertyName) .Replace("{listPropertyName}", listPropertyName)
.Replace("{primaryKeyPropertyName}", primaryKeyPropertyName) .Replace("{primaryKeyPropertyName}", primaryKeyPropertyName)
.Replace("{primaryKeyFullName}", primaryKeyFullName) .Replace("{primaryKeyFullName}", primaryKeyFullName)

View File

@ -10,6 +10,7 @@ namespace BlueWest.EfMethods
{ {
var returnTypeFullName = model.ReturnTypeFullName; var returnTypeFullName = model.ReturnTypeFullName;
var entityTypeName = model.EntityTypeIdentifierName; var entityTypeName = model.EntityTypeIdentifierName;
var entityFullTypeName = model.EntityTypeFullName;
var listPropertyName = model.ListPropertyName; var listPropertyName = model.ListPropertyName;
var contextFullName = methodsModel.ContextFullType; var contextFullName = methodsModel.ContextFullType;
var propertyName = model.PropertyName; var propertyName = model.PropertyName;
@ -24,6 +25,7 @@ namespace BlueWest.EfMethods
templateToSourceBuilder templateToSourceBuilder
.Replace("{returnTypeFullName}", returnTypeFullName) .Replace("{returnTypeFullName}", returnTypeFullName)
.Replace("{entityTypeName}", entityTypeName) .Replace("{entityTypeName}", entityTypeName)
.Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{listPropertyName}", listPropertyName) .Replace("{listPropertyName}", listPropertyName)
.Replace("{primaryKeyPropertyName}", primaryKeyPropertyName) .Replace("{primaryKeyPropertyName}", primaryKeyPropertyName)

View File

@ -19,6 +19,7 @@ namespace BlueWest.EfMethods
var byParamVarName = model.ByParamPropertyName.ToCamelCase(); var byParamVarName = model.ByParamPropertyName.ToCamelCase();
var findEntityVarName = model.EntityTypeIdentifierName.ToCamelCase(); var findEntityVarName = model.EntityTypeIdentifierName.ToCamelCase();
var propertyName = model.PropertyName; var propertyName = model.PropertyName;
var entityFullTypeName = model.EntityTypeFullName;
if (!addSourceTemplate.IsEmpty()) if (!addSourceTemplate.IsEmpty())
{ {
@ -26,9 +27,9 @@ namespace BlueWest.EfMethods
templateToSourceBuilder templateToSourceBuilder
.Replace("{returnTypeFullName}", returnTypeFullName) .Replace("{returnTypeFullName}", returnTypeFullName)
.Replace("{entityTypeName}", entityTypeName) .Replace("{entityTypeName}", entityTypeName)
.Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{byParamPropertyName}", byParamPropertyName) .Replace("{byParamPropertyName}", byParamPropertyName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{byParamFullType}", byParamFullType) .Replace("{byParamFullType}", byParamFullType)
.Replace("{byParamVarName}", byParamVarName) .Replace("{byParamVarName}", byParamVarName)
.Replace("{findEntityVarName}", findEntityVarName) .Replace("{findEntityVarName}", findEntityVarName)

View File

@ -12,6 +12,7 @@ namespace BlueWest.EfMethods
{ {
var returnTypeFullName = model.ReturnTypeFullName; var returnTypeFullName = model.ReturnTypeFullName;
var entityTypeName = model.EntityTypeIdentifierName; var entityTypeName = model.EntityTypeIdentifierName;
var entityFullTypeName = model.EntityTypeFullName;
var propertyName = model.PropertyName; var propertyName = model.PropertyName;
var listItemTypeName = model.ListEntityIdentifierName; var listItemTypeName = model.ListEntityIdentifierName;
@ -36,7 +37,7 @@ namespace BlueWest.EfMethods
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{primaryKeyPropertyName}", primaryKeyPropertyName) .Replace("{primaryKeyPropertyName}", primaryKeyPropertyName)
.Replace("{listPrimaryKeyPropertyName}", listPrimaryKeyPropertyName) .Replace("{listPrimaryKeyPropertyName}", listPrimaryKeyPropertyName)
.Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{primaryKeyFullName}", primaryKeyFullName) .Replace("{primaryKeyFullName}", primaryKeyFullName)
.Replace("{primaryKeyVarName}", primaryKeyVarName) .Replace("{primaryKeyVarName}", primaryKeyVarName)
.Replace("{listPrimaryKeyFullName}", listPrimaryKeyFullName) .Replace("{listPrimaryKeyFullName}", listPrimaryKeyFullName)

View File

@ -16,13 +16,14 @@ namespace BlueWest.EfMethods
var contextFullName = methodsModel.ContextFullType; var contextFullName = methodsModel.ContextFullType;
var findEntityVarName = model.EntityTypeIdentifierName.ToCamelCase(); var findEntityVarName = model.EntityTypeIdentifierName.ToCamelCase();
var propertyName = model.PropertyName; var propertyName = model.PropertyName;
var entityFullTypeName = model.EntityTypeFullName;
if (!addSourceTemplate.IsEmpty()) if (!addSourceTemplate.IsEmpty())
{ {
var templateToSourceBuilder = new StringBuilder(addSourceTemplate); var templateToSourceBuilder = new StringBuilder(addSourceTemplate);
templateToSourceBuilder templateToSourceBuilder
.Replace("{returnTypeFullName}", returnTypeFullName) .Replace("{returnTypeFullName}", returnTypeFullName)
.Replace("{entityTypeName}", entityTypeName) .Replace("{entityTypeName}", entityTypeName)
.Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{findEntityVarName}", findEntityVarName) .Replace("{findEntityVarName}", findEntityVarName)
@ -68,7 +69,6 @@ namespace BlueWest.EfMethods
templateToSourceBuilder templateToSourceBuilder
.Replace("{returnTypeFullName}", returnTypeFullName) .Replace("{returnTypeFullName}", returnTypeFullName)
.Replace("{entityFullTypeName}", entityFullTypeName) .Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{entityTypeName}", entityTypeName) .Replace("{entityTypeName}", entityTypeName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)

View File

@ -18,6 +18,7 @@ namespace BlueWest.EfMethods.Sources
var keyPropertyName = model.KeyPropertyName; var keyPropertyName = model.KeyPropertyName;
var keyTypeFullName = model.KeyFullTypeName; var keyTypeFullName = model.KeyFullTypeName;
var existingVarName = entityTypeName.ToCamelCase(); var existingVarName = entityTypeName.ToCamelCase();
var entityFullTypeName = model.EntityTypeFullName;
var keyVarName = entityTypeName.ToCamelCase() + model.KeyPropertyName; var keyVarName = entityTypeName.ToCamelCase() + model.KeyPropertyName;
if (!updateSourceTemplate.IsEmpty()) if (!updateSourceTemplate.IsEmpty())
{ {
@ -30,6 +31,7 @@ namespace BlueWest.EfMethods.Sources
.Replace("{contextFullName}", contextFullName) .Replace("{contextFullName}", contextFullName)
.Replace("{propertyName}", propertyName) .Replace("{propertyName}", propertyName)
.Replace("{keyTypeFullName}", keyTypeFullName) .Replace("{keyTypeFullName}", keyTypeFullName)
.Replace("{entityFullTypeName}", entityFullTypeName)
.Replace("{keyPropertyName}", keyPropertyName) .Replace("{keyPropertyName}", keyPropertyName)
.Replace("{keyVarName}", keyVarName) .Replace("{keyVarName}", keyVarName)
.Replace("{existingEntityVarName}", existingVarName); .Replace("{existingEntityVarName}", existingVarName);