MVC - 从实体框架中的存储过程中选择 [英] MVC - Select from Stored Procedure in Entity Framework

查看:300
本文介绍了MVC - 从实体框架中的存储过程中选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ASP.NET MVC的新手。我应该创建一个页面,用户可以通过中央仓库为他们的商店订购。产品和数量由数据库中的存储过程列出。我必须在gridview中显示由存储过程计算的行。在用户在gridview上进行更改后,我想在SQL中将更改的数据插入到表中。用户可以将已保存的文件回叫并对其进行更改并将其重新保存。



我无法构建如何制作策略。如果我使用实体框架,我可以在网格中显示SQL表格行,但这不是我的目标。我必须让SQL首先计算数据。请你给我一些起点和步骤,继续吧。我希望我可以解释一下我需要的。

解决方案

有一些简单的步骤来实现



1-从数据库转到并更新模型,并添加所需的存储过程



复杂类型在返回数据时映射您存储的过程字段。



3-并将该复杂类型映射到存储过程。并使用它作为您使用表。


I am new to ASP.NET MVC. I should create a page where users enters an order for their shops by central warehouse. The products and amounts are listed by a stored procedure from database. I have to show rows in a gridview which are calculated by the stored procedure. I want to insert the changed data in a table in SQL after the user make changes on the gridview. Users can call the saved doc back and make changes on it and save it again.

I can't build a strategy how that can be made. If I use Entity Framework I can show the SQL table rows in grid but it is not my goal. I have to let the SQL calculate first the data. Could you please give me some start point and steps to go ahead. I hope I could explain what I need.

解决方案

There Are some simple steps to do that

1- Go and update model from database and add the required Stored procedure

2- create a complex type from model browser

in complex type map your Stored procedure fields as it returns the data.

3- and map that complex type to the stored procedure. and use it as you use table.

这篇关于MVC - 从实体框架中的存储过程中选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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