Update: Support extended logging arguments
This commit is contained in:
@@ -11,13 +11,13 @@ namespace Disco.Services.Logging.Targets
|
||||
{
|
||||
public LogPersistContext(string ConnectionString) : base(ConnectionString) { }
|
||||
|
||||
static LogPersistContext()
|
||||
{
|
||||
Database.SetInitializer<LogPersistContext>(new LogPersistContextInitializer());
|
||||
}
|
||||
|
||||
public DbSet<Models.LogModule> Modules { get; set; }
|
||||
public DbSet<Models.LogEventType> EventTypes { get; set; }
|
||||
public DbSet<Models.LogEvent> Events { get; set; }
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
//modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Logging.Targets
|
||||
{
|
||||
public class LogPersistContextInitializer : IDatabaseInitializer<LogPersistContext>
|
||||
{
|
||||
public void InitializeDatabase(LogPersistContext context)
|
||||
{
|
||||
if (!context.Database.Exists())
|
||||
{
|
||||
context.Database.Create();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user