使用实体框架存储二进制文件(blob) [英] Store binary file (blob) using entity framework

查看:97
本文介绍了使用实体框架存储二进制文件(blob)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Entity framework(edmx)将带有fileUpload控件的二进制文件(Doc,Pdf,txt ..)类型(blob)存储到数据库中Asp.NET c#







使用EF和ASP.NET在SQL Server中存储图像



就像这个例子一样,但不是MVC!



非常感谢您的帮助!

Hi , I would like to store binary file (Doc , Pdf , txt..) type (blob) with fileUpload control into database using Entity framework(edmx)Asp.NET c#



Storing Images in SQL Server using EF and ASP.NET

Like this exemple posted but not with MVC !

thanks much for your help !

推荐答案

好方法是将图像保存在应用程序中的文件夹,并将图像的路径/名称放在DB中。在考虑性能时,在DB中显示图像不是一个好主意。



查看下面提到的文章,这些文章将展示如何处理ASP.net网页表单。但是你必须将上面的文章和下面的文章结合起来才能获得完整的解决方案。



将图像保存到文件夹和数据库



保存图片



保存图片
The good approach is that save the image in a folder in your application and put the path/name of the image in your DB.Storing an image in DB is not a good idea,when considering the performances.

Check below mentioned articles which will show how to do with ASP.net web forms.But you have to combine the above article and with the below ones for complete solution.

Save Image to Folder and Database

Save image

Save image

看看这个,你可以重用一些东西和代码相同的MVC用EF



http://www.intstrings.com/ramivemula/asp-net/save- files-to-a-table-in-database-using-fileupload-control / [ ^ ]
Have a look into this, You can reuse some stuffs and code the same for MVC with EF

http://www.intstrings.com/ramivemula/asp-net/save-files-to-a-table-in-database-using-fileupload-control/[^]


这篇关于使用实体框架存储二进制文件(blob)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆