Created
January 3, 2015 10:56
-
-
Save msrivastav13/d1a91445fb20a91f9bfb to your computer and use it in GitHub Desktop.
WCF Data Services make it easy to create an OData service using an ADO.NET Entity Data Model by providing a generic DataService class that is constructed using an ADO.NET Entity Data Model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------ | |
// <copyright file="WebDataService.svc.cs" company="Microsoft"> | |
// Copyright (c) Microsoft Corporation. All rights reserved. | |
// </copyright> | |
//------------------------------------------------------------------------------ | |
using System; | |
using System.Collections.Generic; | |
using System.Data.Services; | |
using System.Data.Services.Common; | |
using System.Linq; | |
using System.ServiceModel.Web; | |
using System.Web; | |
namespace WebApplication5 | |
{ | |
public class WcfDataService1 : DataService<ShoppingListEntities> | |
{ | |
// This method is called only once to initialize service-wide policies. | |
public static void InitializeService(DataServiceConfiguration config) | |
{ | |
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. | |
// Examples: | |
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); | |
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All); | |
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment