This is in relation to this question:
What to put in Business Logic Layer?
With the answers in this question (haven't yet selected an answer as there might be others willing to comment to make it clearer for me), I've came to the conclusion that BLL would include CRUD and would access DAL as needed.
My main problem now is what does my BLL look like? Say for example, an Order object. For CRUD, I see some implementations that has OrderService which is part of BLL like this:
public class OrderService
{
public int CreateOrder(Order order)
{
...
}
public int UpdateOrder(Order order)
{
...
}
//... other code for CRUD
}
The thing with this is aside from the Business objects, I have business object-related services in BLL?
While on some other they do something like this:
public class Order
{
public int ID { get; set; }
public decimal Amount { get; set; }
//... etc.
public int Create()
{
...
}
public int Update()
{
...
}
}
But this seems somehow wrong (combining the CRUD operations and the properties).
How is BLL (CRUD and Business Object) typically structured?
Also, since data would typically come from UI input then populated to the Business object, how would I validate data? For example I have property Total for order and List, Total should equal to total amount of OrderItem. When doing say CreateOrder, how would I invoke validation? I always thought that validation should be done inside the actual property setters. How would I invoke this during CRUD? Should I implement an Validate method in Business Object too?
Any input about this would be very welcome.