简体   繁体   中英

Entity Framework 3.5 Not adding all Properties in Model

I'm experiencing an unusual issue with Entity Framework in VS2008. The problem is when I create my Entity Model from my existing database, the designer add all the corresponding tables but it appears that it randomly omits some of my Foreign Key fields. Yet if I browse the Model in the Browser I can clearly see that the fields were included.

This became apparent when during the build I started receiving multiple errors that these fields were not mapped. This led me to manually add the fields in the designer to the corresponding tables and map them to the datasource.

After this however, I get multiple errors: Error 102 Error 10023: Could not find the conceptual model to validate.
Error 103 Error 10024: Could not find the storage model to validate.
Error 104 Error 10025: Could not find the mapping model to validate.
Error 105 Could not find the Conceptual Schema node to embed as a resource for input file Error 106 Could not find the Storage Schema node to embed as a resource for input file Error 107 Could not find the Mapping node to embed as a resource for input file

When I open the edmx file in XML Editor, the file is riddled with squiggly lines.

I have successfully created the Entity Model in VS2010 without issue but our client isn't at 4.0 Framework.

I have identified others having the issue but I can't find any resources to assist on fixing the problem.

Any suggestions would be greatly appreciated.

This is probably EF1 did not support foreign keys. So for foreign key columns EF will create navigation properties but will not create foreign key properties on the Entities. You can find foreign properties in model browser but this is in the model representing the database and not the conceptual model. Note that navigation properties are modeled based on foreign keys in the store and you are not losing the relationship functionality even though you don't have foreign keys exposed. In other words - if you use navigation properties in queries they will be translated correctly to use foreign key values in the SQL queries. One thing where having foreign key properties in the conceptual model is very useful is when you would like to reason or modify a relationship without having to load the related entity - if you know the key value you just set the foreign key property to this value and you are done with it. This is impossible in EF1 - whenever you need to change the relationship or query against a related entity you first need to load said entity and use navigation property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM