File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
- # Entity Framework Core 2 .x
1
+ # Entity Framework Core 3 .x
2
2
3
3
* Install ` FirebirdSql.EntityFrameworkCore.Firebird ` from NuGet.
4
4
* Create your ` DbContext ` .
9
9
``` csharp
10
10
class Program
11
11
{
12
- static void Main (string [] args )
13
- {
12
+ static void Main (string [] args )
13
+ {
14
14
using (var db = new MyContext (" database=localhost:demo.fdb;user=sysdba;password=masterkey" ))
15
15
{
16
- db .GetService <ILoggerFactory >().AddConsole ();
17
-
18
16
db .Demos .ToList ();
19
17
}
20
18
}
21
19
}
22
20
23
21
class MyContext : DbContext
24
22
{
23
+ static readonly ILoggerFactory MyLoggerFactory = LoggerFactory .Create (builder => { builder .AddConsole (); });
24
+
25
25
readonly string _connectionString ;
26
26
27
27
public MyContext (string connectionString )
@@ -35,7 +35,9 @@ class MyContext : DbContext
35
35
{
36
36
base .OnConfiguring (optionsBuilder );
37
37
38
- optionsBuilder .UseFirebird (_connectionString );
38
+ optionsBuilder
39
+ .UseLoggerFactory (MyLoggerFactory )
40
+ .UseFirebird (_connectionString );
39
41
}
40
42
41
43
protected override void OnModelCreating (ModelBuilder modelBuilder )
You can’t perform that action at this time.
0 commit comments