Ok, so I am starting to learn Linq and implementing it into a small project where I have a CreateUserWizard and my database with all the regular aspnet_User etc membership tables. So I created a Linq to SQL Class and pulled all of these regular database
tables into it, because I want to be able to get the UserId and UserName etc. But when I did this, and tried accessing the .dbml file I get all these errors saying Error 1 The type 'mysite.aspnet_Membership' already contains a definition for '_ApplicationId'
mysite.designer.cs etc for all of the tables and a partial method may not multiple defining declarations, and stuff like that. What did I do wrong? I'm guessing because the CreateUserWizard already uses these pieces that it can't be settup like this or what?
Can someone explain it to me please and let me know how to do this without duplicating the methods I guess?
Just saying "I did some stuff and got a lot of errors" is not particularly useful to anyone wanting to help you. You would be better off concentrating on one error at a time. Detail the steps you took to generate it and then provide the actual error message.
I can't post them all, I merely added a mysiteLinq.dbml and pulled over the Tables for
aspnet_User
aspnet_Membership
aspnet_Application
aspnet_Profile
All of which above are being used already by the CreateUserWizard I'm guessing, so they are already linked up which is why I am assuming I am getting the errors?
then added the following code to try to read the UserID
mysiteLinqDataContext db = new mysiteLinqDataContext();
var userId = from a in db.aspnet_Users
where a.UserName == useernametb.Text
select a.UserId;
all of the errors are either - The type 'mysite.(table from the above list)' already contains a defination for '(the row in each table listed one by one like 'LastLoginDate')' or - A partial metho may not have multiple definaing declarations
That's litterally all that happened, and all I really have on the page is a CreateUserWizard, but I am putting some extra fields on it, hence why I want to use Linq to be able to get the ZipCode etc that aren't in the regular userwizard fields of Name, password,
email, question.
I fixed this, it had to do with an entity framework model I was playing with that I didn't delete completely out. So it was trying to run everything twice basically.
ebolt007
Member
48 Points
26 Posts
110 errors, what? for Linq
Nov 14, 2011 05:47 AM|LINK
Ok, so I am starting to learn Linq and implementing it into a small project where I have a CreateUserWizard and my database with all the regular aspnet_User etc membership tables. So I created a Linq to SQL Class and pulled all of these regular database tables into it, because I want to be able to get the UserId and UserName etc. But when I did this, and tried accessing the .dbml file I get all these errors saying Error 1 The type 'mysite.aspnet_Membership' already contains a definition for '_ApplicationId' mysite.designer.cs etc for all of the tables and a partial method may not multiple defining declarations, and stuff like that. What did I do wrong? I'm guessing because the CreateUserWizard already uses these pieces that it can't be settup like this or what? Can someone explain it to me please and let me know how to do this without duplicating the methods I guess?
Thanks
Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: 110 errors, what? for Linq
Nov 14, 2011 06:56 AM|LINK
Just saying "I did some stuff and got a lot of errors" is not particularly useful to anyone wanting to help you. You would be better off concentrating on one error at a time. Detail the steps you took to generate it and then provide the actual error message.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
ebolt007
Member
48 Points
26 Posts
Re: 110 errors, what? for Linq
Nov 14, 2011 06:04 PM|LINK
I can't post them all, I merely added a mysiteLinq.dbml and pulled over the Tables for
aspnet_User
aspnet_Membership
aspnet_Application
aspnet_Profile
All of which above are being used already by the CreateUserWizard I'm guessing, so they are already linked up which is why I am assuming I am getting the errors?
then added the following code to try to read the UserID
mysiteLinqDataContext db = new mysiteLinqDataContext(); var userId = from a in db.aspnet_Users where a.UserName == useernametb.Text select a.UserId;all of the errors are either - The type 'mysite.(table from the above list)' already contains a defination for '(the row in each table listed one by one like 'LastLoginDate')' or - A partial metho may not have multiple definaing declarations
That's litterally all that happened, and all I really have on the page is a CreateUserWizard, but I am putting some extra fields on it, hence why I want to use Linq to be able to get the ZipCode etc that aren't in the regular userwizard fields of Name, password, email, question.
Thanks
Gaspard
Contributor
2066 Points
416 Posts
Re: 110 errors, what? for Linq
Nov 14, 2011 06:56 PM|LINK
In such scenario, debugging can help, step by step, you can see what is going on
http://msdn.microsoft.com/en-us/library/zxfz3z3h.aspx
Regards
ebolt007
Member
48 Points
26 Posts
Re: 110 errors, what? for Linq
Nov 14, 2011 09:12 PM|LINK
I fixed this, it had to do with an entity framework model I was playing with that I didn't delete completely out. So it was trying to run everything twice basically.
Thanks