I'm building WCF service and I have a question about WCF service design:
For example:
If I have a data accass layer with two class Person and Product:
public class Person
{
public DataTable Select()
{...}
}
public class Product
{
public DataTable Select()
{...}
}
Both class has Select() method. To use these classes in WCF, I used two ways in my previous procjects
1) Create two service class PersonService and ProductService:
public class PersonService : IPersonService
{
public DataTable Select()
{
Person person = new Person();
return person.Select();
}
}
public class ProductService : IProductService
{
public DataTable Select()
{
Product product = new Product();
return product.Select();
}
}
In this case, I have to create/configure service classes separately.
2) Create one service class and use different names:
public class MyService : IMyService
{
public DataTable PersonSelect()
{
Person person = new Person();
return person.Select();
}
public DataTable ProductSelect()
{
Product product = new Product();
return product.Select();
}
}
In this case I have to create/configure only one service class. But methods has larger names (for example: PersonSelect() instead of Select())
Which is the better way? and why?
Thanks.