Services Wizard can help you generate ServiceStack services for the persistent classes in your model. This topic will guide you through the process.
Suppose you already have a web application project in your solution, and a class library that holds your Data Access model. If you do not, you can create such a structure with the help of the Telerik Data Access Web Application project template.
To create the web services, you need to:
Right-click the .rlinq file in Solution Explorer and select Add Telerik Data Access Service...
If you don't have a .rlinq file, e.g. you have a Fluent Model project, you can start the wizard by using the context menu of the Web Application where the service will reside.
This will bring up the Service Wizard. The first page of the wizard is the Select Source and Output dialog. From the Select context drop-down select your domain context. By default, it is named EntitiesModel. From the Host in Project drop-down select the project that will contain the output. In this example, the project that contains the domain model and the project that will contain the generated controllers are the same - WebApplication. Check the Use Existing Project option and select your web project.
Click Next to continue. The Select Service Type dialog appears. You need to select the service type. Select ServiceStack Service.
Click Next. In the Service Configuration dialog, select for which entities the wizard should generate services. By default all entities are selected. Also you have the option to specify what CUD operations can be performed on the selected entities. More special is the case when your domain model contains views. You can use the views only for read operations. By default, if your view doesn't have a primary key, the corresponding entry in Service Wizard is disabled. If you want to expose a view through a service, you need to specify a primary key in Visual Designer.
Once all selections are done, click Next to proceed. In the Preview dialog, review all changes that will be done in your project.
Click Finish to generate the services.
To test the generated service layer, you need to set the hosting web application as a startup project and to press F5.
ServiceStack allows the free usage of up to 10 service methods. If your service layer will contain a higher number of methods, you need to provide a ServiceStack license key in the Web.config file of the hosting web application.
To see what is the outcome of the service generation, check out the Service Generation Outcome topic.