I have an Azure Mobile Service Project (.Net backend) and an ASP.Net MVC 5 project in the same Visual Studio solution. If I add a model class to the Azure Service project say Customer.cs extending EntityData. How can I have CRUD access to this object from ASP.Net MVC.
Here is what I did currently and I am looking for ways to make it better
- Publish the Mobile Service project to Azure
Add a DTO to the MVC with almost identical fields to the Customer.cs in the Mobile Service project
Add an ADO.Net Entity Data Object that connects directly to the Azure SQL Database backing the Mobile Service
- Scaffold a standard Web API Controller to the MVC project using the CustomerDTO.cs created in Step 2 above and the Customer Entities Context created by step 3 above
- Use Knockout.js to bind the get method of the above step to display
How can I achive the same result differently. The above steps works, but I am concerned about duplication. I ended up with 2 Web API projects?
In the Knockout script, I have this variable which maps to local project2/controllers/customer/get
var Uri = '/api/customers/';
How can I get it to point to the controller method in Project 1, can something like this work
var Uri = 'project1.azure-mobile.net/api/customers/';