Tim
Tim
CC#
Created by Tim on 8/23/2024 in #help
Getting Out of Memory Exception when loading in images
I get a system out of memory error after calling Image.FromFile in GetTarget(). How should I fix this?
public ImageManager()
{
_tiles = new List<Bitmap>();
GetTarget();
LoadAll();
}

private void GetTarget()
{
_target = (Bitmap)Image.FromFile(@"C:\Users\timo2\OneDrive\Desktop\The Grind\Personal Projects\PhotoMosaic\PhotoMosaicGenerator\downloaded_images\image_20.jpg");
}
public ImageManager()
{
_tiles = new List<Bitmap>();
GetTarget();
LoadAll();
}

private void GetTarget()
{
_target = (Bitmap)Image.FromFile(@"C:\Users\timo2\OneDrive\Desktop\The Grind\Personal Projects\PhotoMosaic\PhotoMosaicGenerator\downloaded_images\image_20.jpg");
}
56 replies
CC#
Created by Tim on 7/20/2024 in #help
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
OnConfiguring
:
optionsBuilder.UseSqlite($"Data Source=mtg.db");
optionsBuilder.UseSqlite($"Data Source=mtg.db");
and also have the following object instantiated in the same class:
public DbSet<Card> Card { get; set; }
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);
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?
126 replies