Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created October 15, 2012 14:29
Show Gist options
  • Save jfromaniello/3892756 to your computer and use it in GitHub Desktop.
Save jfromaniello/3892756 to your computer and use it in GitHub Desktop.
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