简体   繁体   中英

ASP.NET MVC3 database creation

So, I am in class and we create the database the good ol fashioned way by logging into the database via a host and running sql commands to create table blah blah blah. This is the way I am used to coming from the php side of things with simple web sites.

Then I ran into the tutorials ( http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/adding-a-model ) that use DBContext to generate the db structure via I believe scaffolding. Is this a new feature that we are expected to use as part of that framework? Or is it not a best practice to use this feature. Security vs. Functionality what are the pros/cons of each if any. Thanks guys.

Well, how do you like the idea of not having to ever really care if you have a database? Do you like writing a data access layer or would you rather create your class and let the MVC framework worry about how to persist it?

I think there are pros and cons to each approach. Some of the auto-generated database stuff can be a little kludgy and I personally enjoy creating databases anyway.

Here's an article that might help:

http://msdn.microsoft.com/en-us/data/gg685489.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM