Add project files.
This commit is contained in:
26
OemanTrader.EntityFramework/OemanTraderDbContext.cs
Normal file
26
OemanTrader.EntityFramework/OemanTraderDbContext.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using OemanTrader.Domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OemanTrader.EntityFramework
|
||||
{
|
||||
public class OemanTraderDbContext : DbContext
|
||||
{
|
||||
|
||||
public DbSet<User> Users { get; set; }
|
||||
public DbSet<Account> Accounts { get; set; }
|
||||
public DbSet<AssetTransaction> AssetTransactions { get; set; }
|
||||
public OemanTraderDbContext(DbContextOptions options) : base(options) { }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<AssetTransaction>().OwnsOne(x => x.Asset);
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user