locked
Confused about database first or code first for my new application using asp.net mvc5 RRS feed

  • Question

  • User-471420332 posted
    I am very new to asp.net mvc 5 and confuse to start using database first or code first for my new application below are my projects requirements.

    1. User part

    User registration
    User login
    After login user will submit big application form
    Change password
    Forgot password

    2. Admin part

    Admin will see counts of applications
    Admin Evaluation application by Rating to that user submitted application



    Tuesday, July 17, 2018 7:01 PM

All replies

  • User-821857111 posted

    Your requirements are irrelevant to your decision. You would use Database First if you are working with an existing database. If you don't have a database, you should use code first to generate the database and then use migrations to keep your database schema in sync with your model. You can also use code first with an existing database, which is also recommended above database first. The Database First approach has been dropped entirely in ASP.NET Core.

    Tuesday, July 17, 2018 7:16 PM
  • User-471420332 posted
    I am using visual studio 2013 and I tried some example using database first. Shall I have to go with database first using entity framework, one more doubt database first using entity frame or ado.net which one is good..
    Tuesday, July 17, 2018 7:32 PM
  • User-821857111 posted

    If you prefer to work with data as objects, use EF. If you are happy with DataReaders and DataTables, use ADO.NET.

    Tuesday, July 17, 2018 8:13 PM
  • User1120430333 posted

    I am using visual studio 2013 and I tried some example using database first. Shall I have to go with database first using entity framework, one more doubt database first using entity frame or ado.net which one is good..

    If you going to go what ADO.NET, then go with SQL Command Objects, parametrized inline T-SQL, parametrized stored procedures, a datareader a custom type like a DTO or DTO(s) is a collection for CRUD operations with the database.

    You know that's what an ORM like EF is really doing is the above under the hood.

    https://www.codeproject.com/Articles/1050468/Data-Transfer-Object-Design-Pattern-in-Csharp

    https://dzone.com/articles/reasons-move-datatables

    Myself, I have never had a problem with database first. I have seen a whole lot of people have problems with code first, becuase they don't have a good grasp on object oriented programming, and they don't database administration 101, just out there winging it.

    Tuesday, July 17, 2018 9:07 PM