ullfindsmit
asked on
Linq Composite Object Return From Logic
I am trying to break down the architecture into three independent layers Data/Logic and App (Web/Service/Application/W S)
As posted on my previous question https://www.experts-exchange.com/questions/25355958/Linq-Error.html
I have now set up my objects in ABC.Data and my DataContext in ABC.Logic
However, what I am running in to is that I can only return objects in my ABC.Data library.
How do I handle selecting Customer Information as well as other columns relevant to the query and returning it to the APP layer without having to create classes?
Example:
// I CANT RETURN A LIST OF CUSTOMER AND STATE INFO LIKE SPECIFIED IN THE QUERY
public List<Test1.Logic.Customer> GetCustomerByStateName(Str ing StateName)
{
Test1.Logic.DataClasses1Da taContext db = this;
return (
from c in db.Customers
join cl in db.CustomerLocations on c.CustomerId equals cl.CustomerId
where cl.USState.USStateAbbr == StateName
select c, cl
).ToList<Test1.Logic.Custo mer>();
}
Hope this explains what I am trying to do.
Thanks
Smit.
As posted on my previous question https://www.experts-exchange.com/questions/25355958/Linq-Error.html
I have now set up my objects in ABC.Data and my DataContext in ABC.Logic
However, what I am running in to is that I can only return objects in my ABC.Data library.
How do I handle selecting Customer Information as well as other columns relevant to the query and returning it to the APP layer without having to create classes?
Example:
// I CANT RETURN A LIST OF CUSTOMER AND STATE INFO LIKE SPECIFIED IN THE QUERY
public List<Test1.Logic.Customer>
{
Test1.Logic.DataClasses1Da
return (
from c in db.Customers
join cl in db.CustomerLocations on c.CustomerId equals cl.CustomerId
where cl.USState.USStateAbbr == StateName
select c, cl
).ToList<Test1.Logic.Custo
}
Hope this explains what I am trying to do.
Thanks
Smit.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
DaTribe I ended up extending all the data objects in my logic library so I can add additional fields without having to read create the base fields from DB.
Labelsoft, what you are recommending is what we are trying to get away from. The system is overengineered for what it is needed for. The amount of time needed to make a simple change is significantly higher in creating these layers that in our case dont really serve a purpose.
Thank you for your time.
Labelsoft, what you are recommending is what we are trying to get away from. The system is overengineered for what it is needed for. The amount of time needed to make a simple change is significantly higher in creating these layers that in our case dont really serve a purpose.
Thank you for your time.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html