Entity Framework 使用 SQL 服务器视图 ASP。网络 api
Entity Framework working with SQL Server views for ASP. NET web api
我正在研究我的第一个 RESTful API 项目,以与我们的 ERP 系统的自动化端进行交互。
我正在计划像 here
这样的 SPA
这个简单的网页是为用户提供他们必须批准或拒绝的采购申请清单。
该应用程序将从 SQL 服务器视图检索数据到集合中。当用户批准或拒绝申请时,这会记录在对象中,当用户按下 'Update ERP' 时,应用程序将构建一个 XML 集合列表并使用 SQL 服务器存储过程插入它进入 ERP 的 SQL 数据库,供自动化流程提取和处理
我有三个问题
这些示例在 EF 中使用了 SQL 服务器表,我应该在 "model" 中构建视图(有些方法!)还是可以使用我的 SQL 服务器查看?
如果我使用我的 SQL 服务器视图,是否需要 ID/唯一键列(例如行号)才能使 EF 更好地工作?
使用 C# class 进行数据检索并使用 SQL 服务器存储过程将 xml 数据发送到数据库中会比 EF 更好吗?
The exampe uses SQL tables in EF should I build the view in the
"model" (some how!) or can I use my SQL view?
使用“Code First to an Existing Database”工作流,您可以select数据库中的视图,EF 将生成类。
If I use my SQL view does it need an ID/ unique key column (for
example row number) to make EF work better?
EF 将尝试识别键列,但它不是很聪明。您可以在初始生成后更改模型。如果你不更新实体,密钥并不重要,但每个实体仍然需要一个密钥。
Would be better using a C# class to do the data retrieval and sending
the xml data into the database with SQL stored procedure than EF?
不,我会使用 EF 进行检索,但可能会直接 ADO.NET 调用存储过程。
我正在研究我的第一个 RESTful API 项目,以与我们的 ERP 系统的自动化端进行交互。
我正在计划像 here
这样的 SPA这个简单的网页是为用户提供他们必须批准或拒绝的采购申请清单。
该应用程序将从 SQL 服务器视图检索数据到集合中。当用户批准或拒绝申请时,这会记录在对象中,当用户按下 'Update ERP' 时,应用程序将构建一个 XML 集合列表并使用 SQL 服务器存储过程插入它进入 ERP 的 SQL 数据库,供自动化流程提取和处理
我有三个问题
这些示例在 EF 中使用了 SQL 服务器表,我应该在 "model" 中构建视图(有些方法!)还是可以使用我的 SQL 服务器查看?
如果我使用我的 SQL 服务器视图,是否需要 ID/唯一键列(例如行号)才能使 EF 更好地工作?
使用 C# class 进行数据检索并使用 SQL 服务器存储过程将 xml 数据发送到数据库中会比 EF 更好吗?
The exampe uses SQL tables in EF should I build the view in the "model" (some how!) or can I use my SQL view?
使用“Code First to an Existing Database”工作流,您可以select数据库中的视图,EF 将生成类。
If I use my SQL view does it need an ID/ unique key column (for example row number) to make EF work better?
EF 将尝试识别键列,但它不是很聪明。您可以在初始生成后更改模型。如果你不更新实体,密钥并不重要,但每个实体仍然需要一个密钥。
Would be better using a C# class to do the data retrieval and sending the xml data into the database with SQL stored procedure than EF?
不,我会使用 EF 进行检索,但可能会直接 ADO.NET 调用存储过程。