Add debug output
This commit is contained in:
parent
ae16f6f7ce
commit
74a391db4f
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -14,6 +15,20 @@ namespace DAL
|
||||
public AppDbContext() : base(nameOrConnectionString: "name=AppDbConnectionString")
|
||||
{
|
||||
Database.SetInitializer(new DbInit());
|
||||
|
||||
|
||||
Database.Log = s =>
|
||||
{
|
||||
if (s.Contains("SELECT"))
|
||||
{
|
||||
#if DEBUG
|
||||
Trace.Write(s);
|
||||
#else
|
||||
Console.WriteLine(s);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
public DbSet<Person> People { get; set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user