OData2Poco is :
1- A Class library : OData2Poco
2- A CommandLine tool named o2pgen

Starting from version 2.0.0 , you can control C# code generation and generate attributes

Sample of the generated code of v 2.0.0 with attributes , nullable data types and navigation properties :

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Spatial;

//uncomment for spatial data type and run Install-Package System.Spatial
//using System.Spatial;

// <auto-generated>
// This code was generated using OData2Poco Class library.
// Service Url: http://services.odata.org/V4/OData/OData.svc
// MetaData Version: 4.0
// </auto-generated>

namespace ODataDemo

public class Product
public int ID {get;set;} //PrimaryKey not null
public string Name {get;set;}
public string Description {get;set;}
public DateTimeOffset ReleaseDate {get;set;} // not null
public DateTimeOffset DiscontinuedDate {get;set;}
public short Rating {get;set;} // not null
public double Price {get;set;} // not null
virtual public List<Category> Categories {get;set;}
virtual public Supplier Supplier {get;set;}
virtual public ProductDetail ProductDetail {get;set;}


Review the complete generated C# code

Last edited Jun 27, 2016 at 3:34 PM by mohamed_hassan, version 11