Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Unassigned: EntityStoreSchemaGenerator.GenerateStoreMetadata does not correctly handle HierarchyID columns [1094]

$
0
0
I noticed the EntityStoreSchemaGenerator.GenerateStoreMetadata method does not seem to gracefully handle HierarchyID columns in all cases. If I attach to a DB that has a table with a HierarchyID non PK column, EntityStoreSchemaGenerator.GenerateStoreMetadata will generate the EntityContainer but will filter out the unsupported HierarchyID column. A warning will be returned from the GenerateStoreMetadata method indicating this.

warning 6005: The data type 'hierarchyid' is currently not supported for the target .NET Framework version; the column 'DocumentNode' in table 'HierarchyID2.dbo.Table_1' was excluded.

Similarly if I attach to a DB that has a table with a HierarchyID PK column, EntityStoreSchemaGenerator.GenerateStoreMetadata will generate the EntityContainer but will filter out the entire table and return a warning indicating this.

warning 6005: The data type 'hierarchyid' is currently not supported for the target .NET Framework version; the column 'DocumentNode' in table 'HierarchyID.dbo.Table1' was excluded.
warning 6031: The column 'DocumentNode' on the table/view 'HierarchyID.dbo.Table1' was excluded, and is a key column. The table/view has been excluded. Please fix the entity in the schema file, and uncomment.

If a relationship exists on a table that was excluded because of a HierarchyID, the relationship is not excluded thus producing an error.

warning 6005: The data type 'hierarchyid' is currently not supported for the target .NET Framework version; the column 'DocumentNode' in table 'HierarchyID.dbo.Table1' was excluded.
warning 6031: The column 'DocumentNode' on the table/view 'msimons_HierarchyID.dbo.Table1' was excluded, and is a key column. The table/view has been excluded. Please fix the entity in the schema file, and uncomment.
error 6004: The table 'HierarchyID.dbo.Table1' is referenced by a relationship, but cannot be found.

This behavior seems inconsistent with behavior that caused the table to be excluded. This behavior blocks the retrieval of metadata completely in scenarios like this. Is this the intended behavior of GenerateStoreMetadata? Why doesn’t the relationship get excluded as well in this scenario?

Invoking EntityStoreSchemaGenerator.GenerateStoreMetadata on the SQL2012 version of AdventureWorks will illustrate this issue.

Error message "The table 'AdventureWorks2012.Production.Document' is referenced by a relationship, but cannot be found."
Comments: When working on this code we tried change ".NET Framework version" to "target EF schema version". I just checked and we missed this in a few cases. This is however a separate issue so I created a new work item for reviewing the messages: https://entityframework.codeplex.com/workitem/1103

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>