When I generate my EdmModel using Microsoft.Data.OData.dll, v5.6.1.0 as follows:
var eModel = new Microsoft.Data.Edm.Library.EdmModel();
var container = new EdmEntityContainer("namespace...", "container1");
var eRowType = ...;
eModel.AddElement(eRowType);
var eSet = container.AddEntitySet("...", eRowType);
eModel.AddElement(container);
and then generate the metadata with
ODataMessageWriter payloadWriter = new ODataMessageWriter(payloadResponse, settings, eModel);
payloadWriter.WriteMetadataDocument();
I get xml that does not have IsDefaultEntityContainer="true"
.
Some OData libraries require that attribute.
How can I add it?
You can try the SetIsDefaultEntityContainer() method:
eModel.AddElement(container);
eModel.SetIsDefaultEntityContainer(container, true);