3

I have an issue with Simple Membership with SQL server using Entity framework code first.

When I run

WebSecurity.InitializeDatabaseConnection( "MyDB", "Users", 
                                          "UserID", "Username", true);

on my own development pc, It creates the following tables

dbo.Users
dbo.webpages_Membership
dbo.webpages_Roles
dbo.webpages_UsersInRoles

But, when I run the site on a host it creates the tables as:

myusername.Users
myusername.webpages_Membership
myusername.webpages_Roles
myusername.webpages_UsersInRoles

Please, how do I get the simple membership provider to create the tables with the default dbo schema?

Shai
  • 111,146
  • 38
  • 238
  • 371
Layinka
  • 405
  • 1
  • 4
  • 13

2 Answers2

2

You can find here a good way to do this without specify a default schema for your user.

You just need to follow this implementation and define the default schema. Like this:

[Table("webpages_Membership", Schema = "SCHEMA_NAME")]
Gui Ferreira
  • 4,367
  • 6
  • 28
  • 41
0
WebSecurity.InitializeDatabaseConnection uses the default schema 
assigned to your Database User to create\access the tables 
for the SimpleMembershipProvider.

So you need to change the default schema your user has on the Database on your host.

Does your host allow you to set the default schema for your Database User?

Peter
  • 91
  • 1
  • 3