OData v4 Client Code Generator

Microsoft Free

An item template that simplifies the process of accessing OData v4 services by generating C# and VB.Net client-side proxy classes.

(3) Review
Visual Studio
2015, 2013, 2012
Download (30,070)
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Reviews (3)
Q and A (31)
Sign in to write a review
Sort by:

by rahul7720 | November 16 2015

Awesome tool.
Increased productivity.

No Annotations generated.

by LongDinhLe | October 21 2015

This scaffolding is pure awesomeness for OData v4..!

by ImGonaRot | November 26 2014

Great start but falls short in a few areas such as authentication and function / action calls.

Sign in to start a discussion

  • Adding User and password
    1 Posts | Last post January 27, 2016
    • Dear , I need to access an OData that requires username and password with BASIC authentication method. How can I customize the 2.4 version to pass these parameters and generate the correct code ?
  • how to exclude some properties from serialising?
    1 Posts | Last post January 18, 2016
    • Hello, i used template to generate client entities and container, then i would like to have some computed properties and made them in partial class of entity, but then on SaveChanges i have error 'cos it tries to serialise those properties. 
      All attributes that i've tried to add to not serialise not worked. Also i dont know how to override the process of serialising to exclude it manually (.Configurations.RequestPipeline.OnEntryStarting might be the ones i need but i cant recognise how to use it)
      Please help, thanks.
  • Custom Routes
    1 Posts | Last post January 13, 2016
    • Does this support custom routes?  If so, how would you add the custom routes?
      Normal: http://localhost:4242/odata/api/v1/Products
      Custom: http://localhost:4242/odata/api/v1/Products(1)/Orders   Where this is custom and logic has been added to grab the correct controller and action.
  • Batch Update
    1 Posts | Last post January 12, 2016
    • Does it support batch update (POST/PATCH/DELETE)? 
  • Data Annotations
    2 Posts | Last post November 16, 2015
    • Is there any plant for DataAnnotation support?
    • For Example:
      [Required ]
      [StringLength(20, Error="Please enter valid data")]
  • Send nested data
    1 Posts | Last post October 15, 2015
    • I have the following domain model:
      A company has 1 or more locations and every location has 1 address.
      So our database contains 3 tables.
      Company 1 .. * Location 1 .. 1 Address
      Our OData model is configured to have 3 entities, Company, Location and Address.
      When i use the Client Code Generator 3 classes are generated, so far so good.
      But when I want to submit data to the OData service I get three calls:
      - One call to [POST] /Company
      - One call to [POST] /Location
      - One call to [POST] /Address
      I would like to have just 1 call to /Company with all the data. 
      The company data, but also the nested location and address data.
      If I configure my OData service to use Complex types for Location and Address this is already happening.
      Is it possible to configure the code client generator in such a way that all data of an object is submitted?
  • Error with Nullable<int>
    3 Posts | Last post October 06, 2015
    • I just upgraded my OData Service and the Client Code Generator, and now some of my FOREIGN KEY fields are nullable.  
      Here are a few code snippets showing you want I mean:
      From SQL Schema (Merchants Table):
      [CoBrandId] INT NOT NULL,
      CONSTRAINT [FK_Merchants_CoBrands] FOREIGN KEY ([CoBrandId]) REFERENCES [CoBrands]([CoBrandId]),
      From Entity Class (Merchant):
      public int CoBrandId { get; set; }
      public virtual CoBrand CoBrand { get; set; }
      From OData generated Metadata:
      <EntityType Name="Merchant">
      		<PropertyRef Name="MerchantId"/>
      	<Property Name="MerchantId" Type="Edm.Int32" Nullable="false"/>
      	<Property Name="IsActive" Type="Edm.Boolean" Nullable="false"/>
      	<Property Name="CoBrandId" Type="Edm.Int32"/>
      	<NavigationProperty Name="CoBrand" Type="Entities.CoBrand">
      From Client Code Generator:
              /// <summary>
              /// There are no comments for Property CoBrandId in the schema.
              /// </summary>
              [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.1.0")]
              public global::System.Nullable<int> CoBrandId
                      return this._CoBrandId;
                      this._CoBrandId = value;
              [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.1.0")]
              private global::System.Nullable<int> _CoBrandId;
              partial void OnCoBrandIdChanging(global::System.Nullable<int> value);
    • I was experiencing the same issue. I'm using Entity Framework and have a Computer class which has a ClientID property and a matching Client virtual property (navigation property). The OData generated metadata didn't explicitly state that the ClientID wasn't nullable, so the code generator made it nullable.
      The fix that worked for me was to add the [Required] attribute to the Client navigation property on the Computer class.
    • @Fazzamar Adding the required attribute did the trick for me. However, it is an interesting assumption to make a non nullable int field nullable with regards to the client code generator.  If we as developers wanted the foreign key field to be nullable we would explicitly set it to a nullable field.  I hope they fix this in the next iteration.  
  • Problem with nested objects
    2 Posts | Last post September 22, 2015
    • Hi,
      I'm using the entire extension over Web API 2.2.
      I'm trying to insert an object which contains nested objects, but the object is received by the API alone without the nested objects.
      Could you please tell me how to do this!
      Thanks in advance
    • We are also seeing this behavior where a child collection (navigation property) consisting of entities is not sent to the ASP.NET Web API OData service with its parent entity when attempting to POST the parent entity. For example, an order with its order line items. Since many of our entities contain related child entities (and they are set up in the EDM as entities), this behavior prevents us from using this otherwise seemingly useful template.
  • There are no comments for Property xx in the schema.
    1 Posts | Last post September 21, 2015
      I got this general comment for all properties:
      There are no comments for Property xx in the schema.
      Any clue to get the property descriptions?
  • Open Source
    3 Posts | Last post September 01, 2015
    • Is this project open source?  I can't seem to find it in the OData repos on github https://github.com/OData.  Thanks.
    • Repo: odata.net - https://github.com/OData/odata.net/tree/master/src/CodeGen
    • Thank you Congyong
1 - 10 of 31 Items