OData / ODataConnectedService

A Visual Studio extension for generating client code for OData Services
Other
79 stars 41 forks source link

Generated Container Is in 'Default' Namespace #377

Closed Alfetta159 closed 6 months ago

Alfetta159 commented 8 months ago

I cannot see how to place the generated Container class into a namespace other than Default. This could be a problem if everyone using these generated objects can't differentiate between different instances of different types of this class. Bug, feature, or am I missing something? All other data objects are in a custom namespace, but the container is not.

aboryczko commented 7 months ago

you probably have the Default Namespace used in your OData Model. if you change it in the metadata it will be reflected in the generated client, you can also override the namespace in the generator

Alfetta159 commented 6 months ago

@aboryczko , What are you referring to when you say, "OData Model"? There are many models used by the EF database context that I am using, but they are just exposed in the OData controllers each representing a DBSet in the EF DB context. Where would I be designating this, "Default Namespace" in the OData API?

aboryczko commented 6 months ago

@Alfetta159 by "OData Model" I mean the EDM that you specify to ASP.NET probably in your Startup

ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
builder.Namespace = "Your.Namespace";
builder.ContainerName = "CustomService";

instead of Default.Container you would get Your.Namespace.CustomService when generating a client from this model's metadata document