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
22
33* Install ` FirebirdSql.EntityFrameworkCore.Firebird ` from NuGet.
44* Create your ` DbContext ` .
99``` csharp
1010class Program
1111{
12- static void Main (string [] args )
13- {
12+ static void Main (string [] args )
13+ {
1414 using (var db = new MyContext (" database=localhost:demo.fdb;user=sysdba;password=masterkey" ))
1515 {
16- db .GetService <ILoggerFactory >().AddConsole ();
17-
1816 db .Demos .ToList ();
1917 }
2018 }
2119}
2220
2321class MyContext : DbContext
2422{
23+ static readonly ILoggerFactory MyLoggerFactory = LoggerFactory .Create (builder => { builder .AddConsole (); });
24+
2525 readonly string _connectionString ;
2626
2727 public MyContext (string connectionString )
@@ -35,7 +35,9 @@ class MyContext : DbContext
3535 {
3636 base .OnConfiguring (optionsBuilder );
3737
38- optionsBuilder .UseFirebird (_connectionString );
38+ optionsBuilder
39+ .UseLoggerFactory (MyLoggerFactory )
40+ .UseFirebird (_connectionString );
3941 }
4042
4143 protected override void OnModelCreating (ModelBuilder modelBuilder )
You can’t perform that action at this time.
0 commit comments