Coder Social home page Coder Social logo

dbfirsteftutorial's Introduction

DbFirstEFTutorial

Step 1: Create the project.

Select the type of project

DbFirstEF-Step_1

DbFirstEF-Step_2

Select the framework version and type

DbFirstEF-Step_3

DbFirstEF-Step_4

Step 2: Import the packages

Enter the NuGet package manager

DbFirstEF-Step_5

The database package must be the same as the database type where the script was used.

DbFirstEF-Step_6

These 2 packages are essential:

DbFirstEF-Step_7

Step 3: Generate models and database context

DbFirstEF-Step_8

The following command must be entered in the console:

Scaffold-DbContext "Data Source={Server Name};Initial Catalog=DbFirstEFTutorial;Integrated Security=True; TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

The string format is:

Scaffold-DbContext + Connection string + DB package + Folder where the models are generalized.

DbFirstEF-Step_9

DbFirstEF-Step_10

Step 4: Correct sensitive information warning caused by database context

The text string in line 24 is passed to the appsettings.json file, and lines 9-11 and 22-24 are removed.

DbFirstEF-Step_11

DbFirstEF-Step_12

Context is added to program.cs so that it can be recognized

DbFirstEF-Step_13

Step 5: Creating views and controllers using Scaffolding

DbFirstEF-Step_14

DbFirstEF-Step_15

DbFirstEF-Step_16

DbFirstEF-Step_17

Files that are generated and end in Controller.cs are moved to the Controllers folder so that they can be recognized.

DbFirstEF-Step_17_1

The _Layout.cshtml navbar accesses are added to be able to access the generated views.

DbFirstEF-Step_18

Resultados:

DbFirstEF-Step_19

DbFirstEF-Step_20

DbFirstEF-Step_21

DbFirstEF-Step_22

DbFirstEF-Step_23

dbfirsteftutorial's People

Contributors

yarethleal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.