fix: adjust sample logging to browser debugger
This commit is contained in:
Родитель
09f926e6bc
Коммит
44e24deeae
|
@ -4,6 +4,7 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace EFCoreSample
|
namespace EFCoreSample
|
||||||
{
|
{
|
||||||
|
@ -57,13 +58,29 @@ namespace EFCoreSample
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
// Uncomment those to enable logging
|
// Uncomment to see EF Core logs in the browser debugger
|
||||||
// optionsBuilder.UseLoggerFactory(LogExtensionPoint.AmbientLoggerFactory);
|
// EnableLogging(optionsBuilder);
|
||||||
// optionsBuilder.EnableSensitiveDataLogging(true);
|
|
||||||
|
|
||||||
// When building in app, use Windows.Storage.ApplicationData.Current.LocalFolder.Path
|
// When building in app, use Windows.Storage.ApplicationData.Current.LocalFolder.Path
|
||||||
// instead of /local to get browser persistence.
|
// instead of /local to get browser persistence.
|
||||||
optionsBuilder.UseSqlite($"data source=/local/local.db");
|
optionsBuilder.UseSqlite($"data source=/local/local.db");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void EnableLogging(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
var factory = LoggerFactory.Create(builder =>
|
||||||
|
{
|
||||||
|
// The Console logger cannot yet be used until .NET WebAssembly supports threading
|
||||||
|
builder.AddProvider(new global::Uno.Extensions.Logging.WebAssembly.WebAssemblyConsoleLoggerProvider());
|
||||||
|
|
||||||
|
// Exclude logs below this level
|
||||||
|
builder.SetMinimumLevel(LogLevel.Information);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Uncomment those to enable logging
|
||||||
|
optionsBuilder.UseLoggerFactory(factory);
|
||||||
|
optionsBuilder.EnableSensitiveDataLogging(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
<assembly fullname="EFCoreSample.Wasm" />
|
<assembly fullname="EFCoreSample.Wasm" />
|
||||||
<assembly fullname="Uno.UI" />
|
<assembly fullname="Uno.UI" />
|
||||||
<assembly fullname="System.Private.CoreLib" />
|
<assembly fullname="System.Private.CoreLib" />
|
||||||
|
|
||||||
|
<assembly fullname="MonacoEditorComponent" />
|
||||||
|
|
||||||
<assembly fullname="SQLitePCLRaw.core">
|
<assembly fullname="SQLitePCLRaw.core">
|
||||||
<!--
|
<!--
|
||||||
|
@ -15,7 +17,7 @@
|
||||||
<!-- This is required by JSon.NET and any expression.Compile caller -->
|
<!-- This is required by JSon.NET and any expression.Compile caller -->
|
||||||
<type fullname="System.Linq.Expressions*" />
|
<type fullname="System.Linq.Expressions*" />
|
||||||
</assembly>
|
</assembly>
|
||||||
|
|
||||||
<!-- EFCore support -->
|
<!-- EFCore support -->
|
||||||
<assembly fullname="Microsoft.EntityFrameworkCore" />
|
<assembly fullname="Microsoft.EntityFrameworkCore" />
|
||||||
<assembly fullname="System.Data" /> <!-- Needed by https://github.com/aspnet/EntityFrameworkCore/blob/2e1115f0f7ba318e1696841fe49993499cb9d8ae/src/EFCore.Relational/Storage/TypedRelationalValueBufferFactoryFactory.cs#L43 -->
|
<assembly fullname="System.Data" /> <!-- Needed by https://github.com/aspnet/EntityFrameworkCore/blob/2e1115f0f7ba318e1696841fe49993499cb9d8ae/src/EFCore.Relational/Storage/TypedRelationalValueBufferFactoryFactory.cs#L43 -->
|
||||||
|
|
|
@ -18,8 +18,6 @@ namespace EFCoreSample.Wasm
|
||||||
#endif
|
#endif
|
||||||
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
|
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
|
||||||
|
|
||||||
//SQLitePCL.Batteries.Init();
|
|
||||||
|
|
||||||
Windows.UI.Xaml.Application.Start(_ => _app = new App());
|
Windows.UI.Xaml.Application.Start(_ => _app = new App());
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Двоичный файл не отображается.
Двоичные данные
src/samples/EFCoreSample/EFCoreSample.Wasm/dotnet-sdk/Microsoft.Extensions.Logging.Configuration.dll
Normal file
Двоичные данные
src/samples/EFCoreSample/EFCoreSample.Wasm/dotnet-sdk/Microsoft.Extensions.Logging.Configuration.dll
Normal file
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичные данные
src/samples/EFCoreSample/EFCoreSample.Wasm/dotnet-sdk/Uno.Extensions.Logging.WebAssembly.Console.dll
Normal file
Двоичные данные
src/samples/EFCoreSample/EFCoreSample.Wasm/dotnet-sdk/Uno.Extensions.Logging.WebAssembly.Console.dll
Normal file
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче