1

Using MVC3, VS 2010 and SQL Express, I have been successful getting through a few tutorials. What I'd like to do now is build my own app which will be deployed. Using Code First, I'd like to have my user authentication and data reside in the same database. From what I've read, it is possible, (acceptable?) but so far I have not found any info on how to get my models and membership to map to the same database - I would like to specify a different DB than aspnet.mdf.

1 Answer 1

2

For the membership tables you can use the aspnet_regsql.exe tool on the command line.

Specify the database and credentials and it will create the membership tables on that database.

You can point the Entity Framework to the same database.

This way, both membership and EF will be living in the same database.

Sign up to request clarification or add additional context in comments.

4 Comments

assuming I'm using code first, to follow your suggestion, I would have to create my models and my database first - correct? I'm starting from a fresh MVC web project with the default connection string pointing to apsnet.mdf.
@Brian - Then you can invoke aspnet_regsql passing in the connection string to this database.
OK - not familiar with this tool, but the connection string uses integrated security = SSPI. No user name or password. Will that work?
@Brian - If you run it under the same credentials that your application runs under (I will assume that this is your account, which should be fine).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.