I downloaded the file ODataV4Metadata.xml
from Microsoft Dynamics 365. This file contains many EntityType
tags in which classes are described. For reference, this is how it (partly) looks:
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Microsoft.Dynamics.CRM" Alias="mscrm">
<EntityType Name="crmbaseentity" Abstract="true" />
<EntityType Name="accountleads" BaseType="mscrm.crmbaseentity">
<Key>
<PropertyRef Name="accountleadid" />
</Key>
<Property Name="accountleadid" Type="Edm.Guid" />
<Property Name="overriddencreatedon" Type="Edm.DateTimeOffset" />
<Property Name="timezoneruleversionnumber" Type="Edm.Int32" />
<Property Name="importsequencenumber" Type="Edm.Int32" />
...etc
This should, for example, generate a class called Accountleads
, with properties like
[DataMember(Name = "overriddencreatedon")]
public System.DateTimeOffset? Overriddencreatedon
{
get
{
return this._Overriddencreatedon;
}
set
{
this._Overriddencreatedon = value;
}
}
As I'm working in .NET-core it seems rather impossible. I was able to generate a HUGE (100k lines of code) file consisting out of all the EntityTypes
with lots of comments. However, it seems I am not able to do this in .NET-core, although I am able to use the generated classes.
The second problem is, it generates just one file, with all classes in it (and it doesn't include all the namespaces beforehand using the using
keyword)
Is there any tool which has some more flexibility, works in .NET-core and generates classes in separate files? Googling it gives many solutions in ASP.NET and .NET v4.
If necessary I will make an Open Source tool to do this, but maybe I haven't looked at enough places.
Sources I checked: