moh-hassan/odata2poco

Support for read-only attributes from *.edmx

Closed this issue · 2 comments

I am attempting to create a poco from Microsoft Business Central, which is admittedly ODataV4 . I am getting desperately close, except that some properties of entities in the Metadata is marked as read-only, but it comes into the generated poco with {get; set;} modifiers. Is there a switch I am missing, or is this currently not supported?

Welcome @dawiehyman to Odata2Poco project
Can you show me sample of the xml schema of Odata v4 service that support readonly properties?
You mean the generated property could be:

         public string  Name {get;}   //rather than {get;set;}

A new package v3.3.0 is released that fix your issue.

The new features:

You can download:

Try the commandline

o2pgen -r http://services.odata.org/V4/TripPinServiceRW -v 

You find the class with ReadOnly properties has get only.

public partial class Airline
	{
	    public string AirlineCode {get;} //PrimaryKey not null ReadOnly
	    public string Name {get;set;} // not null
	}

Let me know if that version fixes your issue.