.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> WCF >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Generic Dal using WCF - Part 3

Posted By:Mahadesh Mahalingappa       Posted Date: September 20, 2011    Points: 200    Category: WCF    URL: http://www.dotnetspark.com  

In this post we will see how we can modify what Entity Framework provided us to achieve a Generic Data Access Layer.
 

 Generic Dal using WCF - Part 3:
 
In this post we will see how we can modify what Entity Framework provided us to achieve a Generic Data Access Layer.

you can also follow the other parts of this series

Generic Dal using WCFGeneric Dal using WCF

Generic Dal using WCF: Part 2
  
This is how the entity framework generated code looked like :
 


Notice that each of the partial class extends a common class EntityObject . We will Build our generics on this concept .
 
 
Create a Dummy class without any Functionality say TEntity . I would extend this class from the EntityObject class as shown below :
 
 
public class TEntity : EntityObject
{
 
}
 
 
Now Modify the EntityFramework generated code to extend from TEntity class instead of the EntityObject class .
 

 
 
We need to do some decoration still to get this ready .
 
  [Serializable()]
  [DataContractAttribute(IsReference = true)]
  public class TEntity : EntityObject
  {
 
  }
 
 
We are done . Our DataAccess layer is ready now .
You could Open the Architecture Explorer and see how the classes are created as shown below :
 


The class Diagram is given below :



Now we need to create a WCF Service Layer . The idea is we would create our Business Layer in the WCF Service itself . WCF service will have methods which will access these entities .

In our next post we will start up with the WCF Business Layer

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend