Web API - Working with Database:
In this tutorial, we will learn about how to use database and entity framework (.Net framework 3.5)

Adding a class library project in the solution:







Important: Since we are using .net framework 3.5, we do need to "Add Code generation Item" by right clicking the entity "PRODUCT" as shown above.
Please follow "Web API (Part 2 Continued) Working with Database using entity framework" next.
In this tutorial, we will learn about how to use database and entity framework (.Net framework 3.5)
- We alread have created Web API in Web API (Part 1)
- In this section, we will create a class library, a sql database and table and add Ado.net entity data model.
- Let's create a test database and using below script, create a Products table as below:
Adding a class library project in the solution:
- Add a class library and name it as "ProductsDataAccess"
- Add one ADO.NET Entity Data Model
- Choose Model content
- Choose data connection and then specify datasource
- Set connection properties and test connection.
- This is how the edmx file will look like
Important: Since we are using .net framework 3.5, we do need to "Add Code generation Item" by right clicking the entity "PRODUCT" as shown above.
Please follow "Web API (Part 2 Continued) Working with Database using entity framework" next.
No comments:
Post a Comment