dotnet-odata4 is a command-line tool for generation OData client proxy classes. It's based on OData Connected Services Extension.
The latest stable version is available on NuGet.
dotnet tool install dotnet-odata4 --global
Argument | Description |
---|---|
-m --metadata |
The URI of the metadata document. The value must be set to a valid service document URI or a local file path. Examples: https://services.odata.org/TripPinRESTierService/(S(read))/ https://services.odata.org/TripPinRESTierService/(S(read))/$metadata c:\temp\metadata.xml c:\temp\metadata.edmx |
-n --no-tracking |
The use of this disables entity and property tracking |
-ns --namespace |
The namespace of the client code generated. Namespaces from metadata document are using as a default. |
-na --no-alias |
This flag indicates whether to disable naming alias. |
-i --internal |
If set to true, generated types will have an "internal" class modifier instead of "public" |
-mf --multiple |
This files indicates whether to generate the files into multiple files or single |
-eoi | Comma-separated list of the names of operation imports to exclude from the generated code. |
-ebo | Comma-separated list of the names of bound operations to exclude from the generated code. |
-est | Comma-separated list of the names of entity types to exclude from the generated code. |
-c | Custom container class name. |
-o --outputdir |
Full path to output directory. Current directory is using as a default. |
-v --verbose |
Turns on the console output. |
-p --proxy |
Proxy server settings. It needs for access to outside Odata V3 service from private networks. Format: domain\user:password@SERVER:PORT |
-pl --plugins |
List of postprocessing plugins. Format: Assembly.dll,Namespace.Class |
OData V4 metadata endpoint and relative output directory:
odata4 -m https://services.odata.org/TripPinRESTierService/(S(read))/$metadata -o ClientDirectory
OData V4 service endpoint, relative output directory and no tracking:
odata4 -m https://services.odata.org/TripPinRESTierService/(S(read))/ -o ClientDirectory -n
OData V4 service endpoint, relative output directory and multiple files:
odata4 -m https://services.odata.org/TripPinRESTierService/(S(read))/ -o ClientDirectory -mf
Metadata document, absolute output directory, output classes namespace and verbocity:
odata4 -m c:\temp\metadata.xml -o c:\temp\OutClientDir -ns Client.Namespace -v
OData V4 metadata endpoint and proxy server settings:
odata4 -m https://services.odata.org/TripPinRESTierService/(S(read))/$metadata -p domain\user:userpassword@proxyserver:8080
Metadata document and list of postprocessing plugins:
odata4 -m c:\temp\metadata.xml -pl Plugin1Assembly.dll,Namespace.PluginClass1 -pl Plugin2Assembly.dll,Namespace.PluginClass2