EF 6中的插入顺序 [英] Order of Insertion in EF 6

查看:302
本文介绍了EF 6中的插入顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在EF6中,我如何保持相同的插入顺序?我遇到了不同的帖子,说EF6在插入时更改了订单,例如:https://stackoverflow.com/questions/34795577/what-logic-determines-the-insert-order-of-entity-framework-6
但我无法理解背后的原因。即使是这种情况,我们如何强制保持相同的顺序,因为在某些情况下它是重要的。例如,我试图记录应该按顺序执行的规则。现在,在重新执行规则之后,由于EF6随机插入,我的执行更改序列改为

In EF6, how can i maintain the same order of insertion? I came across different posts saying that EF6 changes the order while inserting, e.g. https://stackoverflow.com/questions/34795577/what-logic-determines-the-insert-order-of-entity-framework-6 but i am unable to understand the reason behind it. Even if this is the case how can we force to keep the same order as it is important in some cases. For examples i am trying to record rules that should be executed in sequence. Now after retriving the rules back my sequence of execution changes due to random insertion by EF6.

推荐答案


即使链接说开发人员也无能为力。

如果您需要执行超出EF6功能的操作,请转到EF后门, 使用ADO.NET,MS SQL Server命令对象,内联T-SQL或存储过程。

 

以下链接的要点是如何在EF6中使用IObjectContextAdapter,因为你想要的只是通过EF6的连接,这样你就可以开始使用MS SQL Server命令对象并使用ADO.NET而不用EF使用底层的
数据库技术参与CRUD。

https://docs.microsoft.com/en-us / ef / ef6 / modeling / designer / advanced / multiple-results-sets

https://blogs.msdn.microsoft.com/ alexj / 2009/11/07 / tip-41-how-to-execute-t-sql-direct-against-the database /

这篇关于EF 6中的插入顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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