Last_Aeon
Last_Aeon
CC#
Created by Last_Aeon on 6/11/2023 in #help
❔ Question on how AddDbContext works
The rest of the explanation is great and I think I understand the gist of it. Thank you!
26 replies
CC#
Created by Last_Aeon on 6/11/2023 in #help
❔ Question on how AddDbContext works
What is IoC short for?
26 replies
CC#
Created by Last_Aeon on 6/11/2023 in #help
❔ Question on how AddDbContext works
Here is my Online_WriterContext class, but I don't see how the configuration is inbuilt into the class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Online_Writer.Models;

namespace Online_Writer.Data
{
public class Online_WriterContext : DbContext
{
public Online_WriterContext (DbContextOptions<Online_WriterContext> options)
: base(options)
{
}

public DbSet<Online_Writer.Models.Character> Character { get; set; } = default!;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Online_Writer.Models;

namespace Online_Writer.Data
{
public class Online_WriterContext : DbContext
{
public Online_WriterContext (DbContextOptions<Online_WriterContext> options)
: base(options)
{
}

public DbSet<Online_Writer.Models.Character> Character { get; set; } = default!;
}
}
26 replies
CC#
Created by Last_Aeon on 6/11/2023 in #help
❔ Question on how AddDbContext works
Assuming that db is a fresh new instance of the Online_WriterContext, how does db.SaveChangesAsync() know to do the correct thing
26 replies