1

We are using Internet Application in ASP.Net MVC 4 project. Since Simplemembership is out of the box feature hence membership creates the following table on our database :

webpages_Membership
webpages_Roles
webpages_UsersInRoles

But our database team, is not ready to have table names prefix with "webpages". They are ok to create the following table:

Project_Membership
Project_Roles
Project_UsersInRoles

where "Project" prefix is specific to our project.

Now is it ok if we create a Database view as webpages_Membership on top of SC_Membership table and so our membership provider should connect to view for authenticating the user. Is it possible. Any thought on this would be highly appreciated.

-Sanjiv

  • 1
    possible duplicate of [SimpleMembership with custom database schema in ASP.NET MVC 4](http://stackoverflow.com/questions/12360126/simplemembership-with-custom-database-schema-in-asp-net-mvc-4) – CodeCaster Aug 22 '13 at 08:50
  • See for example [this question](http://stackoverflow.com/questions/4197674/insert-data-into-a-view-sql-server) on inserting data into a view. – CodeCaster Aug 22 '13 at 08:51

1 Answers1

0

In Application start call WebSecurity.InitializeDatabaseConnection() with these parameters:

public static void InitializeDatabaseConnection(
    string connectionString,
    string providerName,
    string userTableName,
    string userIdColumn,
    string userNameColumn,
    bool autoCreateTables
)
el_shayan
  • 2,735
  • 4
  • 28
  • 42
  • this only specify the user table name. what about other ones! – A Khudairy Oct 19 '13 at 22:51
  • I don't think you can change them. In SimpleMembershipProvider and SimpleRoleProvider they are defined as "internal static string" and they are readonly. Not even in any way virtual to override. – el_shayan Oct 20 '13 at 07:46