views:

94

answers:

2

Ok this one is might not have a straight forward answer but lets see.

I am trying to design a DAL that will sit on the network and serve EF objects to developers who are writing clients that need to use our database.

For example:

The DAL has some EF objects called PERSON and DEPARTMENT.

A developer wants to write a client that can reference the DAL using WCF and has exposed to him a proxy context and the EF objects so he can perform normal looking LINQ queries at design time. At run time this query is passed to the DAL which actually executes it and passed the resultant objects back to the client

        var query = from c in DALReference.PERSON
                    where c.FISTNAME == "FRED"
                    select c;

        foreach ( PERSON p in query)
        {
            lstItems.Items.Add(p.FIRSTNAME);   
        }

Now I've read a load of stuff around about how EF v1 is not mature enough yada yada yada. That's not going to work for me. I need code up a solution for a large project that has to be in by Sept next year at the latest so I can't wait for v2 or .NET 4

I've also read about POCO's and Persistence Ignorance by to be honest its all so fragmented I am struggling to get my head around it.

So anyone want to help out with some easy to understand examples, guides or suggestions on how I can achieve this?

Oh yeah and one final piece of the puzzle. I need to communication to happen over TCP not HTTP.

Thanks!

+1  A: 

Have you looked at ADO.NET Data Services or RIA Services? Both do more or less what you want, in slightly different ways. I'd start with one of them unless I had a really pressing need not to.

Craig Stuntz
ADO.NET Data Services only communicate over HTTP. Which won't work for me. The data I'm trying to shunt down the pipe might be quite large and I believe will therefore need to be binary
Spanners
Just had a thought...Unless there is a way to get ADO DS to transmit as TCP?
Spanners
Silverlight 4 supports TCP, so RIA Services should, too. But I've never tried it.
Craig Stuntz
ADO.NET is basically a REST implementation, no TCP by definition.
jfar
+1  A: 

Your going to have to use RIA Services or something like this: http://code.msdn.microsoft.com/exprserialization to send expression trees over the wire to whatever your data store is.

Edit:

Wanted to add that EF4 works pretty well right now and its certainly better at handling detached entities i.e. objects that go across a wire and become disconnect from your context.

This article may be helpful: http://msdn.microsoft.com/en-us/magazine/ee335715.aspx

jfar