I'm developing and multi-tier application solution and my solution looks like this
- Business.DomainObject
- Business.Process (* Actual business layer)
- Data.Mapper
- Data.Repository
- Data.Sql.Entity (* Actual data layer that has .dbml file)
My Business.Process project (business layer) is only knows Business.DomainObject and Data.Repository projects, so doesn't know and not in relationship with Data.Sql.Entity project
I'm sending business (domain) objects to repository and do mapping inside this project, then I'm doing CRUD process inside repository layer with relationship data layers.
My traditional domain object is like this, it has only properties
public class UserBO
{
public string Email { get; set; }
public string Username { get; set; }
public string Password { get; set; }
}
My business layer class is like this,
Repository r = new UserRepository();
r.Insert(myUserDomainObject);
Everything is OK, but I have some problems about my "predicate" queries.
I have a method in my repository interface
bool IsExists(Expression<Func<BusinessObject,bool>> predicate);
and use it in my business layer like this;
Repository r = new UserRepository(); <br/>
r.IsExists(p => p.Email.Equals("email address"));
as you can see, its parameter is "business object", but my actual repository (that connects with database) using "dataobject" that is inside my dbml file.
public override bool IsExists(Expression<Func<DataObject, bool>> predicate){
return _table.Where(predicate).Any();
}
I want convert this two predicate, for example I'll send UserBO and convert to UserDataObject
how can i do that?