49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
|
|
{
|
|
public class IntegrationEventLogContext : DbContext
|
|
{
|
|
public IntegrationEventLogContext(DbContextOptions<IntegrationEventLogContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
public DbSet<IntegrationEventLogEntry> IntegrationEventLogs { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
|
{
|
|
builder.Entity<IntegrationEventLogEntry>(ConfigureIntegrationEventLogEntry);
|
|
}
|
|
|
|
void ConfigureIntegrationEventLogEntry(EntityTypeBuilder<IntegrationEventLogEntry> builder)
|
|
{
|
|
builder.ToTable("IntegrationEventLog");
|
|
|
|
builder.HasKey(e => e.EventId);
|
|
|
|
builder.Property(e => e.EventId)
|
|
.IsRequired();
|
|
|
|
builder.Property(e => e.Content)
|
|
.IsRequired();
|
|
|
|
builder.Property(e => e.CreationTime)
|
|
.IsRequired();
|
|
|
|
builder.Property(e => e.State)
|
|
.IsRequired();
|
|
|
|
builder.Property(e => e.TimesSent)
|
|
.IsRequired();
|
|
|
|
builder.Property(e => e.EventTypeName)
|
|
.IsRequired();
|
|
|
|
}
|
|
}
|
|
}
|