Skip to content

Commit 0406b59

Browse files
mmainermmainer
authored andcommitted
Added disambiguation for entities that end with Request.
1 parent 9850b83 commit 0406b59

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

Templates/CSharp/Base/EntityRequest.Base.template.tt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ public string GetEntityGetAsyncMethod(OdcmClass odcmClass, bool initializeCollec
278278

279279
var entityName = this.GetEntityNameString(odcmClass);
280280

281+
// Special case for when an entity name ends with "Request". Associated with the change in EntityType.cs.tt
282+
if (entityName.EndsWith("Request"))
283+
{
284+
entityName = String.Concat(entityName, "Object");
285+
}
286+
281287
this.AppendGetAsyncHeader(entityName, stringBuilder, false);
282288
stringBuilder.Append(Environment.NewLine);
283289
stringBuilder.AppendFormat(" public System.Threading.Tasks.Task<{0}> GetAsync()", entityName);

Templates/CSharp/Base/IEntityRequest.Base.template.tt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ public string GetEntityUpdateAsyncMethod(OdcmClass odcmClass)
314314

315315
public string GetExpandExpressionMethod(string requestType, string underlyingType)
316316
{
317+
318+
// Special case for when an entity name ends with "Request". Associated with the change in EntityType.cs.tt
319+
if (underlyingType.EndsWith("Request"))
320+
{
321+
underlyingType = String.Concat(underlyingType, "Object");
322+
}
323+
317324
var stringBuilder = new StringBuilder();
318325

319326
stringBuilder.Append(
@@ -346,6 +353,13 @@ public string GetExpandMethod(string entityRequest)
346353

347354
public string GetSelectExpressionMethod(string requestType, string underlyingType)
348355
{
356+
357+
// Special case for when an entity name ends with "Request". Associated with the change in EntityType.cs.tt
358+
if (underlyingType.EndsWith("Request"))
359+
{
360+
underlyingType = String.Concat(underlyingType, "Object");
361+
}
362+
349363
var stringBuilder = new StringBuilder();
350364

351365
stringBuilder.Append(
@@ -380,13 +394,6 @@ public string GetSelectMethod(string entityRequest)
380394
public string GetEntityExpandMethods(OdcmClass odcmClass)
381395
{
382396
string entityName = this.GetEntityNameString(odcmClass);
383-
384-
// Special case for when an entity name ends with "Request". Associated with the change in EntityType.cs.tt
385-
if (entityName.EndsWith("Request"))
386-
{
387-
entityName = String.Concat(entityName, "Object");
388-
}
389-
390397
return this.GetExpandMethod(this.GetRequestString(entityName)) +
391398
Environment.NewLine + Environment.NewLine + " " +
392399
this.GetExpandExpressionMethod(this.GetRequestString(entityName), entityName);
@@ -395,13 +402,6 @@ public string GetEntityExpandMethods(OdcmClass odcmClass)
395402
public string GetEntitySelectMethods(OdcmClass odcmClass)
396403
{
397404
string entityName = this.GetEntityNameString(odcmClass);
398-
399-
// Special case for when an entity name ends with "Request". Associated with the change in EntityType.cs.tt
400-
if (entityName.EndsWith("Request"))
401-
{
402-
entityName = String.Concat(entityName, "Object");
403-
}
404-
405405
return this.GetSelectMethod(this.GetRequestString(entityName)) +
406406
Environment.NewLine + Environment.NewLine + " " +
407407
this.GetSelectExpressionMethod(this.GetRequestString(entityName), entityName);

0 commit comments

Comments
 (0)