Skip to content

Commit 53036e5

Browse files
mmainermmainer
authored andcommitted
Turned on template source flag, set config to csharp, updated GetEntityReferencesTypes to inlcude collection references.
1 parent 0a03d3e commit 53036e5

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Templates/CSharp/Base/SharedCSharp.template.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
CustomT4Host host = (CustomT4Host)Host;
66
OdcmModel model = host.CurrentModel;
77
var writer = (CodeWriterCSharp)host.CodeWriter;
8-
bool logTemplateSrc = false;
8+
bool logTemplateSrc = true;
99

1010
#>
1111
<#=writer.WriteHeader()#>

src/GraphODataTemplateWriter/.config/TemplateWriterSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"AvailableLanguages": [ "Android", "ObjC", "CSharp", "PHP", "Python", "TypeScript", "GraphEndpointList" ],
3-
"TargetLanguage": "Android",
3+
"TargetLanguage": "CSharp",
44
"Plugins": [ ],
55
"PrimaryNamespaceName": "com",
66
"NamespacePrefix": "com",

src/GraphODataTemplateWriter/Extensions/OdcmModelExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ public static IEnumerable<OdcmClass> GetEntityReferenceTypes(this OdcmModel mode
8181
// Instead, take the properties that we know are references and not collections and grab the appropriate entity type
8282
// for each, returning those.
8383
var entityTypes = model.GetEntityTypes();
84-
var referencePropertyTypes = model.GetProperties().Where(prop => prop.IsReference() && !prop.IsCollection).Select(prop => prop.Projection.Type).Distinct();
84+
85+
// Removed the !IsCollection condition as that was removing expected entity references from the collection.
86+
var referencePropertyTypes = model.GetProperties().Where(prop => prop.IsReference()).Select(prop => prop.Projection.Type).Distinct();
8587

8688
var referenceEntityTypes = new List<OdcmClass>();
8789
foreach (var referencePropertyType in referencePropertyTypes)

0 commit comments

Comments
 (0)