How to Query from Asp.Net Profile Properties using LINQ

后端 未结 3 1026
心在旅途
心在旅途 2020-12-11 06:24

I have Asp.net profile property Profile.Location, Gender etc

i need to get list of all users whose Location belongs to \"London\" and Gender = male

how do i

3条回答
  •  隐瞒了意图╮
    2020-12-11 06:57

    consider using something like this:

       matches = 
           matches.Union(
              memberDB.aspnet_Profile
              .Where("it.PropertyValuesString Like @first",
               new ObjectParameter("first", "%%" + firstName + "%%")
               ).Select(p => p.UserId));
    

    I should probably mention that we've created an edmx file for our membership database. That said, I'd consider moving all of that interesting information into it's own tables in your application database when you get a chance.

提交回复
热议问题