NET because if you tried to send a Project back with Companies attached, .
Note: this article focuses on Flex & LINQ, but it could as easily be applied to Silverlight & LINQ as well.All associations within the LINQ to SQL designer (DBML) need to have INTERNAL access, to prevent them being sent to the client, and so that you can still use them within the server code. Hungry Method The hungry method involves retrieving just the data objects you require at the time and building up the object model on the client side, eventually sending back an object with related objects.For example: Your client wants the list of projects? This means you don’t have an excessive number of save calls back to the server, and you don’t rely on the foreign key, you rely on the attached object.You then call one Save() method to save the new Project, and let LINQ create the entire collection of Company and Employee records.Now, by default, LINQ will try to send you all the related Companies, Employees and related Suburbs when you ask for the list of Projects.The advantage is that you have complete control over anything being saved into your database, which can be a real advantage in a intricate & lengthy project.Generally using this method, you would need to recall all of your data again, as some associations have been modified.What I will do is talk about strategies on how to leverage LINQ in your Flex app, and how to synchronise data.Let’s take a think about possible methodologies for sending/receiving related object data from server to client: I’ll use the following example to illustrate the different methods: Safety Method The safety method is a simple-to-follow, clear 1:1 system – load an object when you need it, and load the associated objects as you need them.For example: You want to load all Projects from the system, but when you save a Project, you don’t t send back it’s Companies, this property is Transient on the client and doesn’t get send back to the server.If you wanted to save a Company, you’d send back a Company object without the associated Project object, but WITH the Project ID Foreign Key. Lemme give you a scenario: You are writing an Employee database that you wish to use for various Companies. I’m using Fluorine Fx’s most recent revision (r33) posted on Sep 30 in their Google SVN (at time of writing, the most recent version for DL on the Fluorine Fx website is v188.8.131.52, which won’t handle dynamic objects for our purposes).