Entity Framework 6 supports SQL Server 2000?

后端 未结 2 1464
悲哀的现实
悲哀的现实 2021-01-05 00:03

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

相关标签:
2条回答
  • 2021-01-05 00:51

    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.

    0 讨论(0)
  • 2021-01-05 00:55

    Yes, you can use EF 6.x for SQL Server 2000, I'm using this for SQL Server 2000 without any problems.

    But your should set something in your .edmx file of your model.

    Open your model .edmx file with notepad or any text editor, then change this line :

    <Schema Namespace="MyModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2000" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
    

    As you can see, ProviderManifestToken="2000" shows your SQL Server version.EF look this section for generating T-SQL queries and generate scripts under the version.

    0 讨论(0)
提交回复
热议问题