Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> OData V3 support
 

Pages: 1
Bugs & Issues
OData V3 support
Page:1/1 

  Print all messages in this thread  
Poster Message
DJ
User



Location:

Joined on:
14-Jan-2013 11:59:37
Posted:
2 posts
# Posted on: 17-Jan-2013 08:26:07.  
Hi LLBLgen

I'am trying to create a OData WCF service based on V3. I become a compiler problem.

Based on the manual "LLBLGen Pro - generated code- WCF Data Services support" I have created the WCF service. The only change i have made is using a "WCF Data Service (for OData V3)" in stead of "WCF Data Service". I have done that because i will use OData V3.

When compiling the code the next error occure:
The type 'System.Data.Services.DataService`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Services, Version=4.0.0.0, Culture=neutral,
Currently the version of this assembly in my project is 5.0.0.0.

My question is how can LLBLgen support OData V3?


In a previous console project i have made sure that the base code generated with LLBLGen is working correct. By the code generation we used the adapeter model.
I am using LLBLGen 3.5. with msvc 2010 with as target .net4

  Top
NMackay
User



Location:
Scotland, United Kingdon
Joined on:
31-Oct-2011 14:55:59
Posted:
138 posts
# Posted on: 17-Jan-2013 11:31:32.  
DJ wrote:
Hi LLBLgen

I'am trying to create a OData WCF service based on V3. I become a compiler problem.

Based on the manual "LLBLGen Pro - generated code- WCF Data Services support" I have created the WCF service. The only change i have made is using a "WCF Data Service (for OData V3)" in stead of "WCF Data Service". I have done that because i will use OData V3.

When compiling the code the next error occure:
The type 'System.Data.Services.DataService`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Services, Version=4.0.0.0, Culture=neutral,
Currently the version of this assembly in my project is 5.0.0.0.

My question is how can LLBLgen support OData V3?


In a previous console project i have made sure that the base code generated with LLBLGen is working correct. By the code generation we used the adapeter model.
I am using LLBLGen 3.5. with msvc 2010 with as target .net4



I think the short answer is no, it might be in V4 but the LLBLGen guys will confirm this.

http://www.llblgen.com/documentation/3.5/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_wcfdataservices.htm

Ef4 has the same limitation I think.

I recently finished a mobile app project for iOS and Android, LLBLGen was used for the ORM layer. I started of using oData but you have to use JSONP requests for that and it has severe limitations. If it's for a Java client I'd recommend a WCF Rest API or Web API approach and return DTOs/POCO classes serialized as json, works much better.

There's an even quicker approach I found on Frans asp.net blog

http://weblogs.asp.net/fbouma/archive/2012/11/04/llblgen-pro-and-json-serialization.aspx


VS2013 C# LLBLGen 4.2 WPF .NET4.5.1 Async, WCF\oData\JSON services\Rest Services  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37860 posts
# Posted on: 17-Jan-2013 14:02:52.  
We'll build v4's odata services dll against the WCF Data Services dll available from nuget, which supports Odata v3.

You can compile v3.5's odata services code against this dll as well, manually:
- get the runtime library sourcecode from the Extras section in the customer area
- load the OdataSupportClasses project into vs.net
- instead of referencing System.Data.Services from the .NET 4/4.5 distribution, reference the one available on nuget.
- make sure you reference the linqsupportclasses and ormsupportclasses dlls in the vs.net project

This should compile fine. It now supports odata v3. We don't do this to v3.5 code today because it will break applications. It's unfortunate MS is this sloppy with distributing .net frameworks but alas, what can you do Regular Smiley

If you want to live on the edge, there's a commented out check in the code as well for inheritance hierarchies, which you can enable. Not tested but odata v3 should support it OK.

Hopefully this gives you what you're after Regular Smiley

Norman's advice in his post is also good advice: it might very well be that you need something else than OData.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
NMackay
User



Location:
Scotland, United Kingdon
Joined on:
31-Oct-2011 14:55:59
Posted:
138 posts
# Posted on: 17-Jan-2013 14:16:39.  
That's customer service for you Regular Smiley

VS2013 C# LLBLGen 4.2 WPF .NET4.5.1 Async, WCF\oData\JSON services\Rest Services  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37860 posts
# Posted on: 17-Jan-2013 14:35:19.  
NMackay wrote:
That's customer service for you Regular Smiley

Thanks Regular Smiley We do our best Regular Smiley
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
DJ
User



Location:

Joined on:
14-Jan-2013 11:59:37
Posted:
2 posts
# Posted on: 18-Jan-2013 10:16:04.  
Thanks, for your advice.

I compiled the LLBLGen OData as described and we have a OData v3 server.

Now we can look furhter.

DJ


  Top
scotru
User



Location:
College Place, WA
Joined on:
16-Feb-2006 01:03:42
Posted:
104 posts
# Posted on: 08-Mar-2013 02:19:55.  
Quote:
I recently finished a mobile app project for iOS and Android, LLBLGen was used for the ORM layer. I started of using oData but you have to use JSONP requests for that and it has severe limitations. If it's for a Java client I'd recommend a WCF Rest API or Web API approach and return DTOs/POCO classes serialized as json, works much better.

There's an even quicker approach I found on Frans asp.net blog

http://weblogs.asp.net/fbouma/archive/2012/11/04/llblgen-pro-and-json-serialization.aspx


Norman, could you speak more specifically to the limitations you encountered with ODATA/JSONP? I'm working on a very similiar project and am trying to make some decisions about SOA. (And also looking at ServiceStack.net).
  Top
NMackay
User



Location:
Scotland, United Kingdon
Joined on:
31-Oct-2011 14:55:59
Posted:
138 posts
# Posted on: 08-Mar-2013 10:10:39.  
scotru wrote:
Quote:
I recently finished a mobile app project for iOS and Android, LLBLGen was used for the ORM layer. I started of using oData but you have to use JSONP requests for that and it has severe limitations. If it's for a Java client I'd recommend a WCF Rest API or Web API approach and return DTOs/POCO classes serialized as json, works much better.

There's an even quicker approach I found on Frans asp.net blog

http://weblogs.asp.net/fbouma/archive/2012/11/04/llblgen-pro-and-json-serialization.aspx


Norman, could you speak more specifically to the limitations you encountered with ODATA/JSONP? I'm working on a very similiar project and am trying to make some decisions about SOA. (And also looking at ServiceStack.net).


Hi Scott,

Biggest issue we encountered with JSONP is error handling (or lack of), as our authentication service and data service were on different ports the browser effectively treats the calls as cross-domain. JSONP gets round this but essentially it won't return anything if your WCF service throws an exception like a 403 if your security key is invalid, This Ajax call show's what kind of error trapping you might want:

Code:

$.ajax({
                type: "POST",
                url: "https://www.myservice.com:8090/Myservice.svc/GetCustomer",
                contentType: "application/json",
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('srv-authorization', localStorage.getItem('MyEncryptedKey));
                },
                data: JSON.stringify(e.dataItem.MyCustomerId),
                dataType: "json",
                cache: false,
                success: function(msg) {
                    custfetchResponse(msg);
                },
                statusCode: {
                    400: function(jxhr, textStatus, errorThrown) {
                        app.hideLoading();
                        ModalViewNotify(APP_MSG2, "Data Service Error");
                    },
                    403: function() {
                        app.hideLoading();
                        ModalViewNotify("Your security key has expired or is invalid", "Security Error");
                        endSession();
                    }
                },
                error: function(jqXHR, textStatus, errorThrown) {
                    app.hideLoading();
                    ModalViewNotify("My Data service is not available at present, please try later", "Server Error");    
                }
            });        


With a JSONP call you can't trap these errors effectively, you have to do a hack that sets a timeout and trap that but you won't know why your service failed.

All modern web browsers use CORS, all the Android, iOS and Blackberry webkit browsers do and Chrome and they are the browser we support. Firefox does after a certain version and IE of course has it's own non standard approach but most modern browsers send a 200 (OPTIONS) request to the WCF service and you have to handle that.

CORS is the moderm approach so if I was starting a new project I wouldn't consider JSONP, also I'm not entirely sure where MS is going with oData, they dropped the Rest API and rolled it into WebAPI even though it's in the .NET4 framework. Also on a 3G connection or lower you have to really consider the amount of data your returning, we just found the performance of the Rest API far better (on UK mobile networks anyway).

We support native iOS, native Android and webkit browser, we've found this approach to be very robust and you still get data back even when you have a weak mobile signal, the less data you have to send over the wire the better IMO.

If your getting data from data service you don't host or control then JSONP is an option as you won't have any control over CORS domain issues.

If you want to chat about this I'm on LinkedIn, just send me an invite.

http://www.linkedin.com/pub/norman-mackay/0/22b/56

Cheers,
Norman.



VS2013 C# LLBLGen 4.2 WPF .NET4.5.1 Async, WCF\oData\JSON services\Rest Services  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.