CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Linq Search on Child

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 2 Followers

Not Ranked
5 Posts
tanny posted on Mon, Jun 4 2012 1:02 PM

All,

I have parent and child class.  For example, my parent class is Customers and child class is CustomerDetails.

I wanted to load all customers with state as NY (where state is property in customer details ). Could someone let me know how this can be done using LINQ?

from p in DataContextObj.Customers where p.CustomerDetails..... ??

 

Regards,

Tanny

Answered (Verified) Verified Answer

Not Ranked
5 Posts
Answered (Verified) tanny replied on Tue, Jun 5 2012 3:23 PM
Verified by RockfordLhotka

Thanks for the reply. I'm using LINQ to SQL classes.

I was also able to achieve what I wanted. I tried using the LINQ query below and it worked.

from p in DataContextObj.Customers where p.CustomerDetails.Any (x => x.State == "NY")

All Replies

Top 10 Contributor
9,270 Posts

You are using the Entity Framework and are using LINQ to Entities?

Or you want to do this query against a graph of business objects already in memory?

Rocky

Not Ranked
5 Posts
Answered (Verified) tanny replied on Tue, Jun 5 2012 3:23 PM
Verified by RockfordLhotka

Thanks for the reply. I'm using LINQ to SQL classes.

I was also able to achieve what I wanted. I tried using the LINQ query below and it worked.

from p in DataContextObj.Customers where p.CustomerDetails.Any (x => x.State == "NY")

Page 1 of 1 (3 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems