Hi
I have built a WCF Data service and I just want to ask what I should write to be able to work with it In a ODataService.
Here’s my WCF dataservice:
using System;using System.Data.Objects;using System.Data.Services;using System.Data.Services.Common;using System.Linq;using System.ServiceModel.Web;using DataServicesJSONP;namespace BD2.Web.Services.WebService{ [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] [JSONPSupportBehavior] public class Room : DataService<ObjectContext>
{ public static void InitializeService(DataServiceConfiguration config) { config.SetServiceOperationAccessRule("GetTime", ServiceOperationRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } [WebGet] public string GetTime() { return DateTime.Now.ToLongTimeString(); } }}(The [JSONPSupportBehavior] is a script to remove dollar-signs from the jsonp that gives troubles with ODataservice. I got it from: http://stackoverflow.com/questions/2983078/cant-get-the-jsonp-working-with-wcf-data-services).
(I use ObjectContxt because I get data from Entity FrameWork Code FIrst. I got help for building it from: http://blogs.msdn.com/b/writingdata_services/archive/2012/05/05/10175174.aspx).
I would like to read in the string from GetTime(). How should my ODataService then be like?:
<telerik:RadODataDataSource runat="server" ID="RadODataDataSource1"> <Transport> <Read Url="http://localhost:52878/Services/WebService/Room.svc/" /> </Transport> <Schema> <telerik:DataModel ModelID="GetTime" Set="???????" /> </Schema> </telerik:RadODataDataSource>Thanks :o)