Skip to content
Caitlin Bales (MSFT) edited this page Jul 14, 2017 · 5 revisions

Vipr: Client Library generation toolkit

Vipr is an extensible toolkit for generating Web service client library. Vipr is highly extensible, enabling you to adapt it to new Web service description languages and to create libraries for new target platforms.

Build and run Vipr

Configuration file settings

Build and run Vipr

You can build and run Vipr from Visual Studio or from the command line. You'll need one of the following installed:

You have two choices for building Vipr, you can open the Vipr.sln file using Visual Studio to build and test Vipr within the IDE, or you can use a Visual Studio command prompt to build Vipr from the command line.

To use the command line, open a Visual Studio command prompt and change to the root of the Vipr repository. You can use any of the following commands:

Command
build Build the default Debug configuration.
build /t:clean Clean the solution.
build /t:rebuild Force the solution to rebuild.
build /p:Configuration=Release Build the Release configuration.
test Run all of the xUnit tests under the 'test' folder.

Once you've built Vipr you run the tool from the command line:

vipr <service-edmx-file>

You can modify Vipr's behavior with command-line options.

Option Description
--reader= Use the reader defined in the specified assembly. The default is ODataReader.v4.
--writer= Use the client library writer defined in the specified assembly. The default is CSharpWriter.
--outputPath= Write the generated client library to the specified path. The default is the current directory.
--modelExport= Write the internal OCDM model as a JSON file to the specified directory. If this option is not specified, the JSON file is not written.

Configuring the CSharpWriter

The C# code client library writer can be configured using a CSharpWriterSettings.json file in a directory called .config. The structure of the JSON file is:

{
  "OdcmNamespaceToProxyNamespace": 
  { 
    "<OdcmNamespace>" : "<ProxyNamespace>"
  },
  "OdcmClassNameToProxyClassName" :
  {
    "<OdcmNamespace>" :
    {
      "<OdcmEntity>" : "<ProxyClassName>"
    }
  },
  "NamspacePrefix":"<string>",
  "OmitUpcastMethods":"<false | true>",
  "ForcePropertyPascalCasing":"<true | false>"
}
Configuration Setting Description
OdcmNamespaceToProxyNamespace Replaces a namespace in a service with the specified namespace in the generated code.
OdcmClassNameToProxyClassName Replaces an entity name in a service namespace with the specified name.
NamespacePrefix Defines a namespace that will be used in front of all generated classes.
ForcePropertyPascalCasing True to generate Pascal cased property names; false to keep the casing from the source service. The default is true.
OmitUpcastMethods False to include a method to cast a base class to a derived class; true to omit the cast method. The default is false.

Vipr uses the Its.Configuration library to manage configuration files. See the README file for Its.Configuration for details.

Clone this wiki locally