[英]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. 我计划首先使用Entity Framework代码将一些对象保存到数据库中,因此我创建了类并从中生成数据库。
The files I store are the following: 我存储的文件如下:
These two are exported using Marmoset Viewer. 这两个是使用Marmoset Viewer导出的。 I plan to store them as object
type. 我打算将它们存储为object
类型。 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? 我的问题是:这样,使用object
类型可行吗? Or do I have to change something? 还是我必须改变一些东西?
The HTML file will be opened using a WebBrowser control. HTML文件将使用WebBrowser控件打开。 It works, but so far I haven't made the database just yet. 它可以工作,但是到目前为止我还没有建立数据库。
Your entities, use byte[]
for storing binary files. 您的实体,使用byte[]
来存储二进制文件。 Your matching table column types should be varbinary
. 您的匹配表列类型应为varbinary
。
You can use System.IO.File.ReadAllBytes to load your entity's property. 您可以使用System.IO.File.ReadAllBytes加载实体的属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.