Ive spent a fair amount of time looking into this issue and cant find a definative answer, but it looks like there is a basic 'incompatibility' with simple membership and entity framework, ie - it just wont work. Ive switched it to a standard sql connection
string and membership work, but that means I now have 2 connection strings for my DB in the web config, one for simpe membership, the other for EF. This is obvioulsy not an ideal solution as Id prefer to use EF for secirity. If anyone has an answer that
would be a big help.
Im using the model first method, not code first as I already have a database design.
misuk11
Participant
1608 Points
1280 Posts
WebSecurity.InitializeDatabaseConnection - No user table found that has the name "UserProfile"
Jan 16, 2013 05:14 PM|LINK
when I execute
WebSecurity.InitializeDatabaseConnection("EBSEntities", "UserProfile", "UserId", "UserName", autoCreateTables: false)
I get this error
No user table found that has the name "UserProfile"
The table does exist in the database and its on my edmx file, does anyone know what the problem could be ?
misuk11
Participant
1608 Points
1280 Posts
Re: WebSecurity.InitializeDatabaseConnection - No user table found that has the name "UserProfile...
Jan 16, 2013 06:05 PM|LINK
the problem seems to be with the type of connection I use. In my web.config I have these 2 connection string entries
<add name="MembershipConnection" connectionString="packet size=4096;user id=user;data source=PC\MSSQLSERVER2008;persist security info=True;initial catalog=EBS;password=password;" providerName="System.Data.SqlClient" />
<add name="EBSEntities" connectionString="metadata=res://*/EbsDataModel.csdl|res://*/EbsDataModel.ssdl|res://*/EbsDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=PC\MSSQLSERVER2008;initial catalog=EBS;persist security info=True;user id=user;password=password;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
this code works
WebSecurity.InitializeDatabaseConnection("MembershipConnection", "UserProfile", "UserId", "UserName", autoCreateTables: false);
this code doesnt
WebSecurity.InitializeDatabaseConnection("EBSEntities", "UserProfile", "UserId", "UserName", autoCreateTables: false);
so a standard sql connection is OK but an EntityFramework (5) isnt, any ideas ?
misuk11
Participant
1608 Points
1280 Posts
Re: WebSecurity.InitializeDatabaseConnection - No user table found that has the name "UserProfile...
Jan 17, 2013 02:25 PM|LINK
Ive spent a fair amount of time looking into this issue and cant find a definative answer, but it looks like there is a basic 'incompatibility' with simple membership and entity framework, ie - it just wont work. Ive switched it to a standard sql connection string and membership work, but that means I now have 2 connection strings for my DB in the web config, one for simpe membership, the other for EF. This is obvioulsy not an ideal solution as Id prefer to use EF for secirity. If anyone has an answer that would be a big help.
Im using the model first method, not code first as I already have a database design.