C#C
C#2y ago
Tim

Issue with DbContext reading in DB Tables

I am trying to use DbContext and the optionsBuilder to connect to my database and obtain a table called "Card". I am doing the following command in
OnConfiguring
:
optionsBuilder.UseSqlite($"Data Source=mtg.db");


and also have the following object instantiated in the same class:

public DbSet<Card> Card { get; set; }


Then, in my main method I run the following lines:

            var context = new MtgContext();
            var dbCards = context.Card.ToList();
            Console.WriteLine(dbCards);

I get an error that "Card" is not a known table even though I have a Card table in the database. What am I doing wrong?
Was this page helpful?