In-Memory Data Provider
RESTier supports building an OData service with all-in-memory resources. However currently RESTier has not provided a dedicated in-memory provider module so users have to write some service code to bootstrap the initial model with EDM types themselves. There is a sample service with in-memory provider here. This subsection mainly talks about how such a service is created. First please create an Empty ASP.NET Web API project following the instructions in Section 1.2. Stop BEFORE the Generate the model classes part.Create the Api class
Create a simple data typePerson with some properties and “fabricate” some fake data. Then add the first entity set People to the Api class:
Create an initial model
Since the RESTier convention will not produce any EDM type, an initial model with at least thePerson type needs to be created by service. Here the ODataConventionModelBuilder from OData Web API is used for quick model building.
Any model building methods supported by Web API OData can be used here, refer to Web API OData Model builder document for more information.
Configure the OData endpoint
Replace theWebApiConfig class with the following code. No need to create a custom controller if users don’t have attribute routing.