我有一个名为ECommerceEntities的EntityModel包含几个实体。如果我想在asp.net mvc的视图中使用这个模型,我可以通过ECommerceEntities实例来查看,或者我可以通过ECommerceEntities中的一个实体。通过EntityModel在asp.net mvc中查看?
我的意思是:
//Can I use this?
public ActionResult Index()
{
ECommerceEntities entity = new ECommerceEntities();
return View(entity);
}
或
//Should I use this?
public ActionResult Index()
{
ECommerceEntities.OneEntity one_entity = new ECommerceEntities.OneEntity();
//filling one_entity here and then send to view
return View(one_entity);
}
感谢。
这也是我的问题的答案和安全建议。非常感谢。 – 2012-04-05 13:57:28
你很欢迎:) – Matt 2012-04-05 14:00:12