Reusing Data Structures using DataApi

in the 'Controllers\DataApiController.cs', will add an api for Orders, OrderDetails, Customers, Shippers and Products:

public class DataApiController : Controller
{
    static DataApi _dataApi = new DataApi();
    static DataApiController()
    {
        _dataApi.Register(typeof(Northwind.Models.Categories),true);
        _dataApi.Register(typeof(Northwind.Models.Orders));
        _dataApi.Register(typeof(Northwind.Models.Order_Details));
        _dataApi.Register(typeof(Northwind.Models.Customers));
        _dataApi.Register(typeof(Northwind.Models.Shippers));
        _dataApi.Register(typeof(Northwind.Models.Products));
    }
    // GET: DataApi
    public void Index(string name, string id = null)
    {
        _dataApi.ProcessRequest(name, id);
    }
} 

Build and go to the browser, under dataApi/ we'll see all the added apis.

2017 10 13 08H07 25

Let's rename the order_details api to orderDetails:

_dataApi.Register(typeof(Northwind.Models.Categories),true);
_dataApi.Register(typeof(Northwind.Models.Orders));
-_dataApi.Register(typeof(Northwind.Models.Order_Details));
_dataApi.Register("orderDetails",typeof(Northwind.Models.Order_Details));
_dataApi.Register(typeof(Northwind.Models.Customers));
_dataApi.Register(typeof(Northwind.Models.Shippers)); 

##Brief review of the Data Api


Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com