c# linq to sql join problem

Posted by b0x0rz on Stack Overflow See other posts from Stack Overflow or by b0x0rz
Published on 2010-05-22T13:57:37Z Indexed on 2010/05/22 14:00 UTC
Read the original article Hit count: 264

Filed under:
|
|
|

i am trying to do

using (UserManagementDataContext context = new UserManagementDataContext())
            {
                var users = from u in context.Users
                            where u.UserEMailAdresses.EMailAddress == "[email protected]"
                            select u;
                return users.Count();
            }

however, when i get to:

using (UserManagementDataContext context = new UserManagementDataContext())
            {
                var users = from u in context.Users
                            where u.UserEMailAdresses.

i do not get offered the EMailAddress name, but rather some neutral default-looking list of options in intelisense.

what am i doing wrong?

table Users

ID  bigint
NameTitle   nvarchar(64)
NameFirst   nvarchar(64)
NameMiddle  nvarchar(64)
NameLast    nvarchar(64)
NameSuffix  nvarchar(64)
Status  bigint
IsActive    bit

table UserEMailAddresses

ID  bigint
UserID  bigint
EMailAddress    nvarchar(256)
IsPrimary   bit
IsActive    bit

obviously, 1 user can have many addresses and so Users.ID and UserEMailAddresses.UserID have a relationship between them: 1 to MANY.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ