XML Ignore EntityKey

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
idkomfs
Posts: 4
Joined: Mon 07 Nov 2016 14:19

XML Ignore EntityKey

Post by idkomfs » Wed 24 Mar 2021 10:13

Hello, how can i ignore the EntityKey (see below) druring XML-Serialization?

<custs>
<cust>
<EntityKey>
<EntitySetName>mdmsqryMT2CADIAdr</EntitySetName>
<EntityContainerName>mdmsEntities</EntityContainerName>
<EntityKeyValues>
<EntityKeyMember>
<Key>AdrNr</Key>
<Value xsi:type="xsd:int">10017</Value>
</EntityKeyMember>
</EntityKeyValues>
</EntityKey>

<data1>
</data1>
<data2>
</data2>
...
</cust>
</custs>


Thanks for help
regards

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: XML Ignore EntityKey

Post by Shalex » Fri 26 Mar 2021 14:45

Solutions:

1. With the EntityObject template, enable also the Data Transfer Objects template to convert entities into DTO-objects. Then, serialize DTO-objects.

2. Use the DbContext template instead of a default EntityObject template not to generate a base EntityObject class. This will avoid the problem with serialization.

idkomfs
Posts: 4
Joined: Mon 07 Nov 2016 14:19

Re: XML Ignore EntityKey

Post by idkomfs » Fri 26 Mar 2021 15:13

Thank you very much!

I wonder where the Information for the EntityKey came from.
I couldn't find it in the Entity-Object-Class. Is it rendered at Serialize-Runtime?

regards

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: XML Ignore EntityKey

Post by Shalex » Mon 29 Mar 2021 15:59

The DataMember attribute is defined for EntityKey by Microsoft: https://docs.microsoft.com/en-us/dotnet ... mework-4.8.

Post Reply