Data Access has been discontinued. Please refer to this page for more information.

Service Generation Outcome

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

Service Wizard of Telerik Data Access can generate ServiceStack services for the persistent classes in your model. This topic will provide you with additional information about the changes Service Wizard makes in your solution:

New DTO Class Library

Service Wizard generates a new class library in your solution, which holds the DTOs that correspond to the persistent classes, the request and response message classes for the DTOs, and the IQueryRequest interface used for the filtering, ordering, and paging functionality. The name of this library follows the pattern <ModelName>ServicesDTOs.

By design, the navigational properties of the persistent classes are not exposed in the generated DTOs.

NuGet Packages Installed In The DTO Class Library

  • ServiceStack.Interfaces

Files Generated In the DTO Class Library

  • <PersistentEntityName>DTO.cs(.vb) - these files hold the DTO classes for the persistent entities you selected on the Service Configuration dialog. Each DTO contains all the properties of the respective persistent class excluding the navigational ones.
  • <PersistentEntityName>ServiceMessages.cs(.vb) - these files hold the service messages used in each of the service operations.
  • IQueryRequest.cs(.vb) - this file holds the interface implemented by the request message passed to the queryable endpoint. It provides the support for filtering, ordering, and paging.

Service Messages Details

Conceptually, in order to execute a CRUD operation in ServiceStack, you are sending a message to a ServiceStack instance, and you are receiving a response message, which holds the result if a reading operation was executed, or holds no explicit result, if the request was successfully accepted. Let's look at an example with the Category entity:

HTTP Verb and Action Request
Get a list of
all categories.
QueryCategories QueryBase<CategoryDTO> QueryResponse<CategoryDTO> Get(QueryCategories request) /Categories
Get category
by Id.
GetCategoryById GetCategoryByIdResponse GetCategoryByIdResponse Get(GetCategoryById request) /Categories/{CategoryID}
Add a new
AddCategory HttpResult Post(AddCategory
Update a
UpdateCategory void Put(UpdateCategory
Delete a
DeleteCategory void Delete(DeleteCategory

*The definition and the implementation of the service methods would be placed in the CategoryService.cs(.vb) file. This file would reside in the project which holds the code base of the service layer.

**The relative URLs would be built in the AppHost class in the hosting web application.

Changes In The Hosting Web Application

Service Wizard performs the following changes on the web application that hosts the ServiceStack services:

NuGet Packages Installed In The Hosting Web Application

  • ServiceStack
  • ServiceStack.Interfaces
  • System.Linq.Dynamic

References Added In The Hosting Web Application

  • <ModelName>ServicesDTOs
  • Telerik.OpenAccess
  • Telerik.OpenAccess.35.Extensions
  • <Your Telerik Data Access Model Project>

Files Generated In The Hosting Web Application

  • AppHost.cs(.vb) - this is the ServiceStack host class. It contains the default routes configuration and the Inversion of Control (IoC) configuration.
  • BaseRepository.cs(.vb) - this file contains the IBaseRepository interface and the BaseRepository class. Together, they provide the support of the CRUD operations executed by Telerik Data Access on the persistent entities. Their implementation follows the Repository pattern.
  • DynamicQueryInfo.cs(.vb) - this class is used by the repositories to convert the query requests to queries for Dynamic Linq.
  • EntitySpecificRepositories.cs(.vb) - this file contains the repositories for the persistent classes selected on the Service Configuration dialog.
  • <PersistentEntityName>Service.cs(.vb) - these files contain the actual implementation of the services for each persistent class you selected on the Service Configuration dialog.

Modified Files In The Hosting Web Application

  • Global.asax.cs(.vb) - Service Wizard inserts the code which initializes the ServiceStack service host.
  • Web.config - Service Wizard takes care to copy the appropriate connection string, and to register the HttpHandlers required by ServiceStack. The handlers are added to both the IIS7 (and higher) configuration and the IIS6 configuration.