1
0
mirror of https://github.com/XFox111/MuiCharts.git synced 2026-04-22 06:51:05 +03:00
Files
MuiCharts/backend/MuiCharts.Infrastructure/DataContext.cs
T
xfox111 39bc85c9d9 - Reworked Infrastructure injection
- Added LettuceEncrypt for HTTPS
- Fixed DataContext
- Moved connection string to appsettings.json
2024-02-22 14:56:15 +00:00

40 lines
1.1 KiB
C#

using Microsoft.EntityFrameworkCore;
using MuiCharts.Domain.Models;
using MuiCharts.Infrastructure.Configurations;
namespace MuiCharts.Infrastructure;
/// <summary>
/// Represents the database context for MuiCharts application.
/// </summary>
public class DataContext : DbContext
{
/// <summary>
/// <see cref="Point"/> table.
/// </summary>
public DbSet<Point> Points { get; set; }
/// <summary>
/// <see cref="Track"/> table.
/// </summary>
public DbSet<Track> Tracks { get; set; }
/// <summary>
/// Initializes a new instance of <see cref="DataContext"/>.
/// </summary>
/// <param name="options">The options for this context.</param>
public DataContext(DbContextOptions<DataContext> options) : base(options)
{
Database.Migrate();
}
/// <inheritdoc/>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new PointEntityTypeConfiguration());
modelBuilder.ApplyConfiguration(new TrackEntityTypeConfiguration());
}
}