0

I apologize for the title of this question, because I don't fully 100% understand what I am even asking.

I'm confused with deployment details of the standard ASP.NET template. I'm using Visual Studio 2015 and I created a new Project using ASP.NET and MVC.

When I create the project, there's a template built out for me that already has user log-ins and password management set up.

enter image description here

When I look at the code, I can find the definition for the DBContext...

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
    public ApplicationDbContext()
        : base("DefaultConnection", throwIfV1Schema: false)
    {
    }

    public static ApplicationDbContext Create()
    {
        return new ApplicationDbContext();
    }
}

I can see there's an App_Data folder which contains an .mdf file. I'm pretty sure DBContext is connecting to this .mdf file somehow, but I think it's obfuscated by the IdentityDBContext.

enter image description here

So my question is: Do people usually just go with this .mdf file when they deploy? I had assumed, probably incorrectly, that one would need a standalone database instance that stores usernames and passwords.

I can see that there's ways to do user administration on the host machine. Is this typical?

Community
  • 1
  • 1
JoeBass
  • 519
  • 7
  • 18
  • Use whatever works for you. – mason Feb 07 '17 at 19:03
  • But is there something clearly wrong with planning to deploy the mdf? What I mean is... is it intended for debug only or something like that? – JoeBass Feb 07 '17 at 19:10
  • It's a local database. You can choose to deploy it or not. It really depends on your use case. If it works for you to have a database you deploy that sits inside your application, then do that. If you'd rather have a standalone database, then do that. Just consider the ramifications of your choices and how it fits into your workflow. – mason Feb 07 '17 at 19:12
  • Thanks. You should post this as an answer so I can give you the coveted points. – JoeBass Feb 07 '17 at 19:14
  • It's not worth answering. "How should one deploy an application?" is too broad. "What do people usually do?" is unaswerable and irrelevant to what you should do. "What is an MDF file?" is something that can be researched elsewhere. "Should I use the MDF file in App_Data?" is primarily opinion based. None of this is really a good fit for Stack Overflow. – mason Feb 07 '17 at 19:17
  • And to add to that, the mdf files are there as examples. If you look at how the project templates are set up there is code to push the data structure out to a database instance like SQL Server. It is better practice to not use the app_data folder for your database, especially concerning user login information. This should be separated out to another instance for a production environment (isolation of concerns). – Chris Bartlett Feb 07 '17 at 19:21

0 Answers0