实体框架6支持SQL Server 2000? [英] Entity Framework 6 supports SQL Server 2000?
问题描述
例如:
SqlVersion
是一个包含SQL Server版本枚举的类,SQL Server 2000在此枚举中。
//< summary>
//这个枚举描述了当前的SQL Server版本。
//< / summary>
内部枚举SqlVersion
{
//< summary>
// SQL Server 8(2000)。
//< / summary>
Sql8 = 80,
//< summary>
// SQL Server 9(2005)。
//< / summary>
Sql9 = 90,
.....
TopClause
是生成select TOP
子句的类,在此类中的方法 WriteSql
,为SQL Server 2000生成特殊的SQL语法。
public void WriteSql(SqlWriter writer,SqlGenerator sqlGenerator)
{
writer.Write(TOP);
if(sqlGenerator.SqlVersion
!= SqlVersion.Sql8)
{
writer.Write(();
}
.....
类似于这些类,还有其他有特殊注意事项的SQL Server 2000?知道SQL Server 2000是否在EF 6中正式支持?
感谢
虽然有代码来处理SQL Server 2000,但是有一些有效的查询实体框架根本无法转换为任何形式的SQL将被该版本的SQL Server接受,这样的查询将导致运行时异常。完全相同的查询在为SQL Server 2005或更高版本构建的模型上起作用。主要的限制是在该版本的SQL中没有获得 APPLY
的效果的好方法服务器。
基本上,您可以使用EF与SQL Server 2000,但它不如新版本有用,您需要以确保您的应用程序使用的每个查询实际上都经过测试,因为它编译的事实并不意味着它将工作。
另外,设计者明确检查SQL Server版本并拒绝SQL Server 2000。
Anybody knows if SQL Server 2000 is supported in EF 6 for Code First? In the official websites I haven't found anything about which SQL Server versions are supported in EF 6. In some blogs I've found that SQL Server 2000 is not supported, but these blogs aren't from official sources. Looking at the source code of EF 6 it seems that is supported I've found some code with SQL Server 2000 considerations.
For example:
SqlVersion
is a class with an enum of SQL Server versions, SQL Server 2000 is in this enum.
// <summary>
// This enumeration describes the current SQL Server version.
// </summary>
internal enum SqlVersion
{
// <summary>
// SQL Server 8 (2000).
// </summary>
Sql8 = 80,
// <summary>
// SQL Server 9 (2005).
// </summary>
Sql9 = 90,
.....
TopClause
is the class that generates a select TOP
clause, in this class in the method WriteSql
, special SQL syntax is generated for SQL Server 2000.
public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
{
writer.Write("TOP ");
if (sqlGenerator.SqlVersion
!= SqlVersion.Sql8)
{
writer.Write("(");
}
.....
And like theses class there are others with special considerations for SQL Server 2000? Anybody know if SQL Server 2000 is official supported in EF 6?
Thanks
Although there is code to handle SQL Server 2000, there are valid queries that Entity Framework simply cannot translate to any form of SQL that will be accepted by that version of SQL Server. Such queries will result in run-time exceptions. The exact same queries do work on a model built for SQL Server 2005 or newer. The main limitation is that there is no good way of getting the effect of APPLY
in that version of SQL Server.
Basically, you can use EF with SQL Server 2000, but it's less useful than on newer versions, and you need to make sure that each and every query your application uses actually gets tested, because the fact that it compiles doesn't mean that it will work.
Also, parts of the designer explicitly check for the SQL Server versions and reject SQL Server 2000.
这篇关于实体框架6支持SQL Server 2000?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!