agiro
agiro

Reputation: 2080

Store an object in database using Entity Framework

I plan to save some objects into a database using Entity Framework code first, so I create the classes and generate the database from that.

The files I store are the following:

These two are exported using Marmoset Viewer. I plan to store them as object type. All I need to do is copy them to folders (and add a new one to the database).

My question is: is this way, going with an object type doable? Or do I have to change something?

The HTML file will be opened using a WebBrowser control. It works, but so far I haven't made the database just yet.

Upvotes: 0

Views: 944

Answers (1)

mxmissile
mxmissile

Reputation: 11673

Your entities, use byte[] for storing binary files. Your matching table column types should be varbinary.

You can use System.IO.File.ReadAllBytes to load your entity's property.

Upvotes: 1

Related Questions