I have DbSets that correspond to tables in a database using Entity Framework (code-first). I have some data that doesn't need to be stored in the database, but it makes sense to access it via the DbContext instance as that is how the program has been created.
public DbSet<z> name0 { get; set; }
public DbSet<y> name1 { get; set; }
public List<x> name2 { get; set; } = new List<x>()
{
new x()
{...},
new x()
{...},
...
I want (in this example) to NOT create any table or reference to name2, but I want to refer to it via the DbContext.
(Yes I know DbContext implies it is stored in the database, I am using the class to store "data", so whether that's externally supplied or through the application itself)
DbSetalways represents a database table or view. If you define aDbSetthe table will be created. Maybe use something like this: stackoverflow.com/a/45485220/13574233List<>s defined which didn't seem to stop EF from producing tables; I just want to define a collection of objects without creating a table and return instances of an object directly from the app without pulling from a database to improve performance.List<YourType>you would dobuilder.Entity<YourType>().Ignore()