Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法获取对象上下文的所有 SQL 更改脚本?
注意:我不是在谈论 ObjectQuery.ToTraceString();
不,不幸的是,产品中没有任何东西可以直接从 ObjectContext 中获得。
但是,您应该看一下 Jarek 的 TracingProvider,它在 EF 和 SqlClient 之间注入了一个层来进行日志记录等。
在这里阅读。