I am using ASPNET membership with 50000 records, and we have another table called "scm_Users" which has exactly number of records, they are NOT linked by any key. I have a simple SQL:
select * from dbo.aspnet_Users a, dbo.scm_Users b
where a.UserName = b.UserName
I can get 50000 records in less than 1 second.
In LINQ, (using Entity Framework) when I am trying to do the same:
IEnumerable<MembershipUser> allMembershipUsers = Membership.GetAllUsers().Cast<MembershipUser>();
ObjectQuery<User> users = this.DataContext.UserSet;
var result = (from a in allMembershipUsers
from b in users
where a.UserName == b.UserName
select new
{
.....
}).AsEnumerable();
When I binded the result to Grid, it got timed out for 50000 records. When I debugged it and I moused over the "result view", it got timed out too. Of course, if I use Membership.FindUsersByName() and limit the number of records, it will return the results peoperly.
And, if I bind 50000 records directly to the Grid without querying on Membership, Grid works too.
var result = (from b in users
select b).AsEnumerable();
What did I do wrong?
N.B.