Sunday, March 04, 2007

Entity Framework Issues in Orcas March 2007 CTP

Following are ADO.NET 3.0 Entity Framework and LINQ to Entities issues and limitations excerpted from the Visual Studio Code Name “Orcas” Release Notes. The information is reprinted here because the release notes don't appear to be widely read.

Note: This post supplements my earlier "Orcas March 2007 CTP Installation Problems" post.

The issues and limitations fall into three classes:

  • SQL Server 2005 [Express] as the data source
  • SQL Server 2005 Compact Edition (SSCE) as the data source
  • LINQ to SQL issue specific to ASP.NET

ADO.NET 3.0 Entity Framework and LINQ to Entities General Issues and Limitations (apply to SQL Server or SSCE as the data source):

23. ADO.NET Entity Framework: Model and Target must be in different namespaces.

To resolve this issue

The Namespace attribute in the Schema element of the Model (.csdl) file should be different from the one in the Target (.ssdl) file. "ADO.NET vNext" throws an exception at runtime if they are the same.

24. ADO.NET Entity Framework: 1:1 relationships are not supported.

1:1 relationships cannot be mapped into the conceptual models of the Entity Data Model.

To resolve this issue

If a 1:1 relationship is present in the database, it can be mapped to a single entity (using entity splitting) if the two tables share the same primary keys.

25. Support for ASP.NET projects.

Assemblies containing ADO.NET Entity Data Models must be compiled outside the ASP.NET website project. They can be used in ASP.NET projects by copying the assembly into the “bin” website directory or adding a reference to them. The CSDL, MSL and SSDL files should also be copied into “bin”. Please refer to the ADO.NET vNext Web sample for more information about how to deploy, locate and load the appropriate CSDL, MSL and SSDL files.

26. Entity Framework requires all tables to have primary keys.

The Entity Data Model requires all entities to have keys. When the ADO.NET Entity Data Model Wizard generates files from a database table without a primary key, the project will not compile until a key is specified in the model files. The wizard will mark these places in the files with element names prefixed with the string "TODO". The wizard also adds warning messages to the Visual Studio task window.

27. LINQ to Entities sample: Working with the modified database.

The sample application should automatically mount the modified Northwind Database. If it is not successful or you have a different version you'd like to use, you can manually mount the database and change the connection string. To change the database that is used by the LINQ to Entities Samples, please change the connection string contained in the “Provider Connection String” setting of the Entity Framework connection string. If you attempt to use the App.Config for a connection string, please see the documentation.

28. LINQ to Entities sample: Adding or changing Entity Framework files.

If you add or change Entity Framework files (e.g., csdl, msl, etc), make sure to have the "Copy To Output" setting in Visual Studio set so that the files are included with any builds.

30. SQL Server Authentication in ADO.NET Entity Data Model wizard.

There is a known issue in the ADO.NET Entity Data Model wizard with using SQL Server authentication and choosing “Yes, include the sensitive data in the connection string”. The wizard disappears after you click “OK”.

To resolve this issue

Either use Windows Authentication or choose “No, exclude sensitive data from the connection string”. This issue is being targeted to be fixed for ORCAS Beta1.

ADO.NET 3.0 Entity Framework and LINQ to Entities General Issues and Limitations Specific to SQL Server Compact Edition (SSCE) 3.5:

7. SQL Server Compact Edition: No support for server-generated keys and server-generated values.

When using the ADO.NET Entity Framework, an entity’s keys may be marked as server generated. This enables the database to generate a value for the key on an insert (entity creation). Additionally, zero or more properties of an entity may be marked as server generated values. A SQL Server Compact Edition database may generate default values for null-valued properties (if a default value has been specified as part of the column definition) when an entity is created or updated. This release of SQL Server Compact Edition, when it is used with the ADO.NET Entity Framework, does not support entities with server-generated keys or values, even though such entity types might be defined in the Model (.csdl) or Target (.ssdl) files.

For more information, see the SQL Server Compact Edition Forum.

8. SQL Server Compact Edition: Paging queries not supported.

Paging queries are intended to support stateless paging (scrolling or windowing) through the results of a query. Paging queries in the ADO.NET Entity Framework can be specified by using the LINQ Skip and Take operators. For example, customers.OrderBy(c => c.Name).Skip(100).Take(20) Paging queries may also be expressed by using the SKIP, LIMIT, and TOP constructs of Entity SQL. For example: SELECT value c FROM NW.Customers AS c ORDER BY c.Name skip 100 limit 20; This release of SQL Server Compact Edition, when it is used with the ADO.NET Entity Framework does not support paging queries.

For more information, see the SQL Server Compact Edition Forum.

9. SQL Server Compact Edition: Full outer joins not supported. Entity SQL supports multiple joins including inner joins, left outer joins and full outer joins. This release of SQL Server Compact Edition does not support Entity SQL queries with full outer joins that use the ADO.NET Entity Framework. As an example, the following query will not be supported: SELECT c.Name, c.Id, o.Id FROM NW.Customers AS c full OUTER JOIN NW.Orders AS o ON c.Id = o.CustomerId

For more information, see the SQL Server Compact Edition Forum.

10. SQL Server Compact Edition: No support for COLLATE subclauses in the ORDER BY clause of an Entity SQL query. Entity SQL enables a COLLATE subclause to be specified as part of each key in an ORDER BY clause. The COLLATE subclause is applicable only for string-valued expressions, and determines the comparison semantics to use for that expression. This release of SQL Server Compact Edition, when it is used with the ADO.NET Entity Framework, does not support the use of a COLLATE subclause in the ORDER BY clause of an Entity SQL query. The following query will not be supported: SELECT value c FROM NW.Customers AS c ORDER BY c.Name COLLATE Traditional_Spanish_ci_ai

For more information, see the SQL Server Compact Edition Forum.

11. SQL Server Compact Edition: No support for command time-outs.

The ADO.NET Entity Framework enables time-outs for commands to be specified by using the ObjectContext.QueryTimeout property or the EntityCommand.CommandTimeout property. This release of SQL Server Compact Edition, when it is used with the ADO.NET Entity Framework, does not support time-outs. That is, the command time-out must not be set to a value other than zero. If a connection time-out property is set, a NotSupportedException(“CommandTimeout”) exception is raised by the SQL Server Compact Edition database.

For more information, see the SQL Server Compact Edition Forum.

12. SQL Server Compact Edition: Supports only Unicode strings.

The ADO.NET Entity Framework provides support for both Unicode and non-Unicode strings. This release of SQL Server Compact Edition supports only Unicode strings. Literal <literal> of type 'String' is not supported by the current provider. The 'near constant literal’ exception is raised by SQL Server Compact Edition in non-Unicode strings.

For more information, see the SQL Server Compact Edition Forum.

13. SQL Server Compact Edition: Limited support for Language Integrated Query.

The ADO.NET Entity Framework supports the Language Integrated Query. This release of SQL Server Compact Edition when it is used with the ADO.NET Entity Framework has limited support for Language Integrated Query. The release has been tested for the Entity SQL queries

For more information, see the SQL Server Compact Edition Forum.

14. SQL Server Compact Edition: Time-out in transaction scope. If the queries in a transaction scope take too long to finish and the transaction scope times out, the data might get committed to the SQL Server Compact Edition database.

To resolve this issue

To avoid such a situation, increase the time-out value.

For more information, see the SQL Server Compact Edition Forum.

LINQ to SQL Issue Specific to ASP.NET

29. LINQ to SQL assembly is not yet enabled for partial trust.

In this CTP, LINQ to SQL cannot be used in ASP.NET medium trust scenarios.

To resolve this issue

Full trust is required in this CTP. We are working on enabling partial trust.

These lists of issues will be supplemented by later posts as I test SSCE, Entity Framework, and LINQ projects under Windows Server 2003 SP1, Windows Server 2003 R2, Windows XP SP2, and Vista.

0 comments: