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