tags:

views:

849

answers:

4

Has anyone used ADO.NET Data Services as a data source for Adobe Flex applications? If so, any success stories or tragedies to avoid? If you did use it, how did you handle security?

+2  A: 

I use WebORB for .NET to do Flex remoting and then use DLINQ on the server. One tricky thing about using LINQ with WebORB is that WebORB uses Reflection to automatically retrieve all the relationships of the object(s) you return to Flex. This causes severe time penalties as LINQ uses lazy loading to load relationships. To prevent this from happening, I do something like the following:

Override your DataContext's constructor and add the following code:

this.DeferredLoadingEnabled = false;
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Order>(q => q.Payments);
dlo.LoadWith<Order>(q => q.Customer);
this.LoadOptions = dlo;

This tells the DataContext to disable deferred loading of relationships and specifically instructs it to load just the relationships you want, without lazy loading. That way, WebORB isn't causing any lazy loading to happen through Reflection and the number of relationships being transferred to Flex is kept at a minimum.

Hope this helps you in some way. It's definitely one of those little "gotchas" when working with Flex/WebORB and LINQ.

Adam Cuzzort
A: 

Yes, we use Flex with .Net web services extensively.

Flex can't handle .Net DataSets, or indeed much by way of complex xml types. We found that it was best to keep to relatively simple xml output.

However, if you do that, it can handle .Net web service output fine:

<mx:WebService id="myDataService" showBusyCursor="true">
    <mx:operation name="WebMethodName" resultFormat="object" result="functionFiredOnComplete();"></mx:operation>
</mx:WebService>

public function load():void
{
    myDataService.loadWSDL( "web method's wsdl" );
    myDataService.WebMethodName.send( params );
}

public function functionFiredOnComplete():void
{     
    // get data
    var myData:Object = myDataService.WebMethodName.lastResult;
    ...
Keith
A: 

He Asked about ADO.NET Data Services not web service

A: