-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
32 lines (27 loc) · 942 Bytes
/
Program.cs
File metadata and controls
32 lines (27 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using CSharpSQLiteCryptExample;
using CSharpSQLiteCryptExample.domain;
using Microsoft.EntityFrameworkCore;
class Program
{
static void Main()
{
using (var db = new AppDbContext())
{
Console.WriteLine("Before Insert ----------------------------");
var persons1 = db.Persons.ToList();
foreach (var person in persons1)
{
Console.WriteLine($"Id: {person.Id}, Name: {person.Name}");
}
db.Persons.Add(new Person { Id = 3, Name = "Alice" });
db.Persons.Add(new Person { Id = 4, Name = "Bob" });
db.SaveChanges();
Console.WriteLine("After Insert ----------------------------");
var persons2 = db.Persons.ToList();
foreach (var person in persons2)
{
Console.WriteLine($"Id: {person.Id}, Name: {person.Name}");
}
}
}
}