Yesterday I assisted to the VISUG session given by Kurt Claeys about Entities in WCF.
This session was very interesting as Kurt presented a little bit WCF and Entity Framework, but the session was mainly an architectural reflection about the use of WCF and Entity Framework, related to Service Oriented Architecture. He described indeed WCF as an enabler to SOA.
Some key information givend during the session:
-
DataContractAttribute is not needed anymore (since VS 2008 SP1) when we need to serialize a type in WCF. Just remind however that the private members won't be serialized and that you still need a parameterless constructor.
-
WCF allow the separation of
-
the Address (done in configuration)
-
the Binding (done in configuration)
-
the Contract (done in compiled code)
-
Entity Framework can be queried using
-
The ObjectContext is the object responsible for doing Change Tracking on entities
-
LINQ to Entities can also use string filters like "it.orderId = 99" where "it" is a keyword representing the current entity
In a distributed world, the client will use WCF to communicate with the business tier and should be "Entity Framework-agnostic". The use of Entity Framework is the server's business, none of the client. Kurt presented also some existing framework that can be used to ensure / help having that separation:
-
-
-
-
Understand POCO as Plain Old CLR Objects, meaning very simple classes, without any attributes or dependency to a framework
-
Based on an ".emdx" file and generates POCO classes
-
Creates an adapter from POCO classes to fill entities
Finally Kurt briefly spoke about Vnext, which will be the next release of ADO.NET / EntityFramework.
-
No planned date : maybe the same as .NET 4.0, or as Visual Studio 2010, or ...
-
Will support out-of-the-box lazy loading and Table Valued Functions
-
Will add a new Interface IEntityWithChanges which is exposing three boolean properties IsNew, IsModified and IsDeleted