English 中文(简体)
页: 1
原标题:asp.net mvc 3: best way manage a model with an image

我试图找到最佳办法管理具有相关形象的模型。

我不知道在数据储存中是否更能坚持形象。

class MyModel {
  ...
  public byte[] ImageData { get; set; }
  ...
}

或拯救乌尔都语,将图像上载到档案系统

class MyModel {
  ...
  public string ImageUrl { get; set; }
  ...
}

至关重要的是,在我制作或编辑模型记录时,我想要掌握图像。

我不想有一个专门的模型/观点/控制器,目的是把图像上载到服务器上。 我想要管理与铝业特定实体相关的形象。

Regards, Giacomo

问题回答

Your first approach is fine because you re storing the image in the database. You will still need a helper function of some sort which generates a URL to a handler which renders/displays the image.

您可以选择,并储存图像,在这种情况下,你必然需要一种帮助方法。

如果你将存储数据库外的图像(例如档案系统),你显然需要<代码>ImageData<>/code>。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签