public class ServerInfo
{
public int ID { get; set; }
public DateTime Startup { get; set; }
}
public class ServerContext : DbContext
{
public DbSet ServerInfos { get; set; }
}
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class ServerInfoService : DataService<ServerContext>
{
public static void InitializeService(DataServiceConfiguration config)
{
ServerContext conn = new ServerContext();
conn.ServerInfos.Add(new ServerInfo() { Startup = DateTime.Now });
conn.SaveChanges();
config.SetEntitySetAccessRule("*", EntitySetRights.All);
}
}
Read more: Mattia Baldingers Blog