Closed SimonFindling closed 1 year ago
@SimonFindling I have implemented it this way. However, certain special entities (such as systemuserroles) do not have a name field.
I suggest not to implement the method for these entities. What do you say? #11
It would be really cool if c# model generation could add a method to generated early bound entity classes that overwrites ToEntityReference or can be used instead of ToEntityReference to generate a EntityReference which has a filled Name attribute.
Sadly this can't be implemented as a generic extension method for Entity class, because PrimaryNameAttribute is only obtainable via entity metadata which would need an Request to be retrieved.
But in model generation we have this information available and could implement a constant Like:
and an Method like:
or completely override the ToEntityReference Method with our own implementation, but I am not sure if this has a negative impact, because the ToEntityReference Method is not virtual.