I set up the SQL Membership provider for my WCF service.
I have custom table Items which has a foreign key that links it to the aspnet_Users table in the db which was created from the Membership provider. When I instantiate an object from type aspnet_User I can access the collection of Items as a attribute to the User obejct. But the membership provider works only with MembershipUser class.
From what I realize the aspnet_User and MembershipUser are somehow linked. When I try to access the Items collection from the MembershipUser it’s not possible because there isn’t an attribute like that.
How do you think I can access my Items collection?
If you think about it, Linq 2 SQL does not know anything about ASP.NET Membership. So why would you expect cooperation between the two systems? This would be magic.
Answer: You can use (Guid)MembershipUser.ProviderUserKey to get the ID of the user. Using that ID you can query the database.