Created
October 15, 2012 14:29
-
-
Save jfromaniello/3892756 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
using System.Data.Services; | |
using System.Data.Services.Common; | |
using System.Linq; | |
namespace TestSingly | |
{ | |
public class SinglyServices : DataService<SinglyContext> | |
{ | |
public static void InitializeService(DataServiceConfiguration config) | |
{ | |
config.SetEntitySetAccessRule("FacebookFriends", EntitySetRights.All); | |
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; | |
} | |
protected override SinglyContext CreateDataSource() | |
{ | |
return new SinglyContext(); | |
} | |
} | |
public class SinglyContext | |
{ | |
public IQueryable<FacebookFriend> FacebookFriends | |
{ | |
get | |
{ | |
return new[]{ new FacebookFriend("Tito"), | |
new FacebookFriend("Pepe"), | |
new FacebookFriend("Juanjo")}.AsQueryable(); | |
} | |
} | |
} | |
[DataServiceKey("Name")] | |
public class FacebookFriend | |
{ | |
public FacebookFriend() { } | |
public FacebookFriend(string name) | |
{ | |
Name = name; | |
} | |
public string Name { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment