Hi friends
I am having the following layers in my application.
1)
Business Objects Layer: a separate project that keeps only entity definitions
2)
Data Access Layer : Crud operations on objects
3)
Business Layer : object operations (Save,Delete,Update,insert)
4)
Service Layer : Exposing the service for Objects
5)
Client : Consuming the services.
My question is that how I can maintain the Business Objects among the layers. I want to traverse the object between the layers. But I don’t know exactly how to implement this.
Suppose I have a Product Object in business object layer,Now I want the following.
1)How to expose this object with the Service layer, will I have to duplicate the product object in service layer as well as at the client side?
Here is the sample code for your review.
Business Objects Layer :
Public class Product
{
Private string Name;
Private string Code ;
…
}
Business Layer :
Public bool Save(Product objProduct)
{
…
}
Data Access Layer :
Public bool Save(Product objProduct)
{
…
}
Service Layer
[ServiceContract]
public interface IProduct
{
[OperationContract]
save(product objproduct);
}
public class product : IProduct
{
Public void save(product objproduct);
}
Client :
ProductService ProductClient = new ProductService();
ProductClient.open();
Product p = new product();
p.name="abc";
p.code="001";
ProductClient.save(P);
ProductClient.Close();
Please guide me.
Many appreciations !!