Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In wcf Interface and classes
and
Repository pattern Using Interface and Classes

except names both are seems same.
Has wcf created from Repository pattern?
Posted
Updated 28-May-14 0:13am
v2
Comments
[no name] 28-May-14 7:30am    
Just because some system or design pattern has interfaces and classes does not mean that they are the same thing.

1 solution

Has wcf created from Repository pattern?
No. Classes/interfaces are more of a Object oriented construct, in this case a VB.Net or C# language thing and is in more general use. Often patterns make use of Interfaces and class inheritance to work, but not specifically to the repository pattern.

The repository pattern can be summed up as a proxy or facade around a data access layer in psuedo-code it would be typically involve wrappering CRUD operations:

C#
public interface IRepository <T>
{
    public void Insert(T entity);
    public void Delete(T entity);
    //For reasons of usability, especially with LINQ the next to would return IQueryable<T>
    IEnumerable<T> GetAll();
    IEnumerable<T> Search(Expression<Func<T,bool>> predicate);
    T GetById(int id); //Assuming an int index..
    void Update(T updatedEntity)
}


With LINQ you'd probably want a Save method to commit updates, the Update would be redundant as you could then do a GetById() --> [update object] --> Save() if correctly implemented.
Though it is possible for WCF to expose something like these methods (e.g. WCF Data Services[^], REST WCF [^], or even something hand-rolled) - this is really one application of WCF, rather than WCF being an example of the repository pattern.

Hope this helps.
 
Share this answer
 
Comments
DGKumar 28-May-14 9:03am    
Thank you very much for resolve my confusion.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900