So the Asp.net RoleProvider wants an array of strings the represents the names of all the Roles a given user is in. So here's the Linq code that I wrote to do that:
return (from u2r in lMainDataContext.User2Roles
where u2r.User.EmailAddress == username
select u2r.RoleTypeEnum.ToString()).ToArray();
The problem, the array that was returned contained the value "2".
Why, because Linq to Sql tries to convert this query to Sql and execute it using the database engine.
The problem is that RoleTypeEnum is an int as far as the database engine is concerned and so it returns a string representation of that int, instead of "Partner" which is what I was expecting.
Splitting the query into two forces Linq to Sql to map the int to an enum:
RoleType[] lMatchingRoles = (from u2r in lMainDataContext.User2Roles
where u2r.User.EmailAddress == username
select u2r.RoleTypeEnum).ToArray();
return lMatchingRoles.Select(r => r.ToString()).ToArray();
Another place where you realize that SQL Server doesn't really know about enums.