27 lines
679 B
C#
27 lines
679 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using MongoDB.Bson;
|
|
using MongoDB.Driver;
|
|
using MongoDB.EntityFrameworkCore;
|
|
using MongoDB.EntityFrameworkCore.Extensions;
|
|
using BasicDotnetTemplate.MainProject.Models.Database.Mongo;
|
|
|
|
|
|
namespace BasicDotnetTemplate.MainProject.Core.Database
|
|
{
|
|
public class MongoDbContext : DbContext
|
|
{
|
|
public MongoDbContext(DbContextOptions<MongoDbContext> options) : base(options) { }
|
|
|
|
public DbSet<Log> Logs { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<Log>().ToCollection("Logs");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|