Author : MD TAREQ HASSAN
Using EF data layer
- For simplycity, we are gonna show how to use
AdevntureWorks.Data
in a console app - For complex appliction
AdevntureWorks.Data
can be used in Repository layer (process is same)
Using EF data layer in a console app
Step-1
Step-2
Step-3
Step-4
Step-5
Step-6
Step-7
Step-8
Step-9
Step-10
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using AdevntureWorks.Data;
namespace AdevntureWorks.ConsoleApp
{
class Program
{
static void Main(string[] args)
{
var awDbContext = new AdventureWorksDbContext();
Debug.WriteLine("List of persons");
foreach (var person in awDbContext.Person.Take(10))
{
Debug.WriteLine($"{person.LastName}");
}
}
}
}