Compartilhar via


Using the Domain Service Wizard

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

The Add New Domain Service Class dialog box is used to add a DomainService object that is used to expose data in a server project from a Data Access Layer (DAL), such as Entity framework or LINQ to SQL.

To access the Add New Domain Service Class dialog box, right-click the server project in the Solution Explorer, select Add and New Item to bring up the Add New Item dialog box.

RIA_AddDomainService

From the Web category of the Installed Templates pane of the dialog box, select the Domain Service Class, click Add, and the Add New Domain Service Class wizard appears.

RIA_AddEntity

See the Walkthrough: Creating a RIA Services Solution for the scenario in which this dialog box is used with the AdventureWorksLT2008 database.

UI Elements

This section contains descriptions of the elements contained in this dialog box.

  • Domain service class name
    Names the instance of the DomainService class. This is read-only property and the name cannot be changed here.

  • Enable client access
    Check this if you want to expose the DomainService to your client. This box is checked by default. Checking this box is what causes RIA Services to generate domain context for a domain service and entities it contains on the client.

  • Expose OData endpoint
    Check this if you want the services to expose an additional endpoint using the OData Protocol. This adds an OData endpoint to the <domainServices> section of the web.config file and marks the parameterless query methods you expose via OData as being the default. This exposes your domain service as an OData feed.

  • Available DataContext/Objectcontext classes
    Use this to select the DAL, such as Entity Framework or LINQ to SQL. The LINQ to SQL option is available only if you have the RIA Services Toolkit installed. You can also select the <empty Domain Service class> option if you want to customize the DAL access from your domain service class. For details on using this option with POCO-defined entities, see How to: Create a Domain Service that uses POCO-defined Entities.

  • Entities
    Use this check list to select the entities from the data source that the domain service will make available to the client.

  • Enable editing
    Check the relevant boxes to indicate which entities selected can be edited. Checking this box will generate CUD (Create, Update, and Delete) methods for the selected entities.

  • Generate associated classes for metadata
    Check this box if you want to generate a partial class that has all the properties of the selected model listed. The user can then apply Validation/Display attributes to these properties.