Sha256: ed986eb98a72ade23ea4d00bbbb7646eb0acffba189ebddfcf594f9a98b0705a
Contents?: true
Size: 1.78 KB
Versions: 8
Compression:
Stored size: 1.78 KB
Contents
using System.Data.Services; using System.Data.Services.Common; using System.Linq; using System.ServiceModel; using System.ServiceModel.Web; using RubyODataService.Models; using System.Collections.Generic; namespace RubyODataService { [ServiceBehavior(IncludeExceptionDetailInFaults = true)] public class RubyOData : DataService<RubyODataContext> { // This method is called only once to initialize service-wide policies. public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("*", EntitySetRights.All); config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; config.UseVerboseErrors = true; } /// <summary> /// Cleans the database for testing. /// </summary> [WebInvoke] public void CleanDatabaseForTesting() { CurrentDataSource.Database.Delete(); CurrentDataSource.Database.CreateIfNotExists(); } [WebGet] public IQueryable<Category> EntityCategoryWebGet() { return CurrentDataSource.Categories; } [WebGet] public IQueryable<string> CategoryNames() { return CurrentDataSource.Categories.Select(c => c.Name); } [WebGet] public int? FirstCategoryId() { return CurrentDataSource.Categories.Select(c => c.Id).FirstOrDefault(); } [WebGet] public Category EntitySingleCategoryWebGet(int id) { return CurrentDataSource.Categories.FirstOrDefault(c => c.Id == id); } } }
Version data entries
8 entries across 8 versions & 1 rubygems