views:

40

answers:

1

my application is using WPF for UI, WCF for WebService, EF4 for DataAccess. I read some materials from internet and msdn that EF4 has self-tracking function using custom T4 template even if using together with WCF for ntier. Does this mean that lazy loading function is still possible with WCF?

Thanks

A: 

The Self-Tracking entities are kind of hacky, IMHO. They are designed so that, once deserialized (i.e, on the far end of your WCF channel), they start tracking changes to themselves. That's great for when you send them back home, because you can reconnect them to a context and everything (hypothetically) works.

Self-tracking and lazy loading are two different things. EF self-tracking entities are disconnected to the data context, and on your client end there IS no data context. So they cannot lazily load anything.

There is no plug-and-play framework mixing WCF and EF that, from the client's perspective, is seamless. Could be done, of course. A few new T4 templates and you'll have an autogenerated WCF service contract your entities could use to perform lazy loading.

Of course, you'd have to write that.
Edit On second thought, you might have more luck going with WCF Data Services.

Will