Adding database configuration - wip
This commit is contained in:
26
MainProject/Core/Database/MongoDbContext.cs
Normal file
26
MainProject/Core/Database/MongoDbContext.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user