JayData.org

JaySvcUtil exposes your OData service metadata to JayData and JavaScript

Author: Peter Aron Zentai April 29th, 2012

, ,


Update: we’ve created JaySvcUtil for node, which is our recommended tool to generate JavaScript data model from OData v4 endpoints. Read this article below only if you would like to generate data model from OData v2/v3 endpoints.

 

JaySvcUtil.exe is a command line tool that downloads an oData service definition ($metadata) and creates a full featured JayData / JavaScript client environment by generating the necessary boilerplate code for you. All you need to do is to include the generated context file and you can start using the OData service with the high level, JavaScript optimized JayData API that supports JavaScript Language Query (JSLQ) and crud operations.

If you are a data API developer you can distribute the generated context and let your users handle data with a manner.

As an example, we will use the Northwind database made available online for testing purposes by Microsoft.

C:\jaydata>JaySvcUtil.exe –-metadataUri http://services.odata.org/Northwind/Northwind.svc/$metadata

–out northwind.js –namespace Northwind

New Project

The resulting northwind.js file is included here for reference:

From now on you only need an html client page that includes both jqeury, JayData.js and the newly forged Northwind.js to let the miracle begin. Smile

JaySvcUtil.exe command line parameters

parameter description default value
metadataUri  / m Required. The uri of the oData $metadata definition. Can be an online resource or a local file as well
out  / o The name of the generated output file. JayDataContext.js
namespace The namespace of the generated JayData EntitContext class. Taken from the service metadata.
contextBaseClass The name of the base class for the generated entity context. $data.EntityContext
entityBaseClass The name of the base class for the generated entity types. $data.Entity
entitySetBaseClass The name of the base class for the generated entity sets. $data.EntitySet
collectionBaseClass The name of the base class for the generated entity sets. Default is Array
autoCreateContext Create an instance of the context with default
parameters.
true
contextInstanceName The name of the automatically generated context instance under the context namespace. Default is context
help Displays parameter options.

, ,