Question

My Current Architecture Plan for my Application is

UI -> WCF Bal -> Generic Dal -> Entity Model

I have created generic Dal methods and the related entity and the specific operation to be performed will be handled from the Business Logic.

I am trying to create a Business logic on wcf and as earlier we used to do separate classes for separate entities so from WCF context m confused how to go about ?

i initially thought of creating a interface which will have generic implementation like

 public interface IBalService<TEntity> where TEntity:class 
{
    [OperationContract]
    IDictionary<int, string> Populatelist();

    [OperationContract]
    IEnumerable<TEntity> Viewall();

    [OperationContract]
    void Insert(TEntity obj);

    [OperationContract]
    void Update(TEntity obj);

    [OperationContract]
    void Delete(TEntity obj);
}

now this interface should have different implementation for different entity say Product, Category, Customer but wcf can have just one Service class...

Any idea what i should do now ???

Was it helpful?

Solution

In a nutshell, what I would do (and successfully done in some projects) is this:

  • Create a Service layer using WCF as an endpoint. This layer can consist of static methods, enclosed in classes that only serve as "namespaces", such as "UserService", "MessagesService" etc. What the world "see" is just these classes.

  • Create your business logic behind it, using traditional full OO classes

  • Create your DAL; in addition of the BL accessing it, the Service Layer can also access it, for simple operations that doesn't justify using a full-blown business logic.

I wouldn't use generics as WCF endpoint, it could be done but if you treat your Service Layer as a single-method-for-single-operation, you will win the option to eventually turn it into a sort of public API (if you want to).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top