readonly option and metadata as string
Closed this issue · 4 comments
I am using Odata2poco as a library in a small project I am experimenting with and I have 2 questions that I could not figure out:
a. Is there an option to control the behavior of the read-only feature that was introduced in #27 ? In my case I need to get the POCO with {get;set;} no matter what is configured in the edmx.
b. Is there a way to provide the OData service metadata to OData2Poco as a string instead of providing the url or filename ?
(I have workarounds for the above, but they are a bit ugly, eg string replace the generated code and use a temporary file)
thanks!
Welcome to OData2Poco Project.
a. Is there an option to control the behavior of the read-only feature that was introduced in #27 ?
Currently, there is no one.
I will add this feature in the next release.
b. Is there a way to provide the OData service metadata to OData2Poco as a string instead of providing the url or filename ?
yes, there is a way to provide string values.
You can save the metadata in an xml file and use the option -x
o2pgen -r file_name.xml // use file instead of url
Great, thanks for the info!
I do not use the command line version for this project, so I use a similar workaround to pass the metadata:
string tmpfile = Path.GetTempPath() + Guid.NewGuid() + ".xml";
File.WriteAllText(tmpfile, _metadata);
var o2pconnstring = new OData2Poco.OdataConnectionString
{
ServiceUrl = tmpfile
};
Was just looking for a way to avoid the intermediate file, but it is fine this way too.
Hi @jkougoulos
A new version v4.2.1 is published in nuget.org that implement your feature request.
How to use: read wiki
try it online
Great, thanks! I will test it and report back if I see any issues