Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8815125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:17:51+00:00 2026-06-14T04:17:51+00:00

Today, I created a new ASP.NET MVC 4 project – Internet application. With all

  • 0

Today, I created a new ASP.NET MVC 4 project – Internet application.

With all the files that comes in the solution in the Account Controller I saw an attribute called [InitializeSimpleMembership]

[Authorize]
[InitializeSimpleMembership]
public class AccountController : Controller
{}

and by only providing a proper db connectionstring property in the web.config

<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.;
Initial Catalog=demo;
User ID=test;Password=test;" providerName="System.Data.SqlClient" />

and when the application runs, it checks if the available database exists or not and if not creates one and adds few memebership tables to it also. I must say I was very very impressed with the new MVC 4 – Internet app template.

Which brings me to my question :
I liked the idea of creating database and executing script from the application. I wanted to know how to add more tables to this.

For example : In the InitializeSimpleMembershipAttribute.cs file it check if a database is present, if not it creates it using the credentials present in the web.config and also adds the following tables to it.

  • UserProfile
  • webpages_Membership
  • webpages_OAuthMembership
  • webpages_Roles
  • webpages_UsersInRoles

what changes do I have to make to have my other tables to be added along with this ?

If this is possible, the idea of keeping sql scripts and executing them on each clean deploy can be avoided. I am working on a self-host MVC app ( It’s Open-source, soon to come on Codeplex 😉 ) so this will really be good for people who want to use my app without getting their hands dirty in SQL scripts.

Please can some one let me know if this is even possible. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:17:52+00:00Added an answer on June 14, 2026 at 4:17 am

    There are two distinct parts to the tables being created:

    1. The UserProfile table is created by adding the attribute [Table(“UserProfile”)] before the model in Models/AccountModels.cs (remember to add it as a DbSet to your context as well).
    2. The ‘webpages_’ tables are created by the WebSecurity.InitializeDatabaseConnection call in Filters/InitializeSimpleMembershipAttribute.cs called by adding the [InitializeSimpleMembership] in Controllers/AccountController.cs. These are ‘internal’ tables required by the SimpleMembershipProvider and you would not typically want to alter them.

    This is called the CodeFirst method of the EntityFramework (your other options are ModelFirst and DbFirst). To have your own POCOs/models auto created you would want to add the Table(“TableName”) attribute similar to UserProfile above.

    Refer to the Entity Framework Website for full walkthroughs of the CodeFirst approach (and much much more).
    http://msdn.microsoft.com/en-us/data/ef.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was using Html.RouteLink(LINKTEXT,RouteName,new RouteValueDictionary()) in asp.net MVC beta without problem, today I upgrade
I have a ASP.NET bulleted list control that, until today, was created and used
Today I started adding unit tests to an ASP.NET MVC project we are developing
Yesterday I was having fully compiled ASP.NET MVC 3.0 project. Today when i opened
I have just started playing with the ASP.Net MVC framework, and today I created
I have an ASP.NET MVC 3 app that is using SQL Server CE 4.0
I'm completely new to JQuery and MVC. I'm working on a pet project that
I have an ASP.NET MVC application where I need to allow to customers configure
I've got an asp.net application which seems to forget that a user is logged
Had something weird start happening to me today. I have an asp.net mvc app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.