I\'m trying to improve my application\'s design, So instead of calling the DataAccess layer from the presentation layer. I\'ll try to implement a save method from my object
You should avoid mixing the domain model with the persistence logic. The examples given above would make a tight coupling solution. In order to achieve the .SaveObject() you can make extension methods in the BL that would do the job.
BL.*
public static class ObjectPersistanceExtensions{
public static SaveObejct(this IBaseEntity obj){
IObjectDal _dal = AvailableSerices.Obtain>();
_dal.AddObject(obj);
_dal.Commit();
}
}
So in this way you can still add functionaries to the domain objects without coupling the logic in the domain objects.