Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No corresponding object layer type could be found for the conceptual type

I have been trying to convert a status table in my database to be an enum that I can access from code.

The initial setup was a Status table with the few entries I needed included (e.g. Active, Inactive etc). To convert I did as follows:

  • Open up EDMX file in Visual Studio 2013, Find Status table and click "Convert to enum" on "Id" field.
  • Changed all references in code where the "Id" field was being set to an Int (cast from enum).

My solution builds and deploys just fine now. The problem is the following error:

No corresponding object layer type could be found for the conceptual type

I get the feeling that the code knows the way the database should be, but the database has not yet been configured.

How can I fix this? Thank you.

Please note that my Entity Framework approach is Database First.

like image 775
jim Avatar asked Nov 01 '14 20:11

jim


2 Answers

Make sure your enum name matches the type name. So for example if the enum is lets say "MyProject.Fully.Qualified.EnumName.MyEnum" Should be called "MyEnum" when you create the enum type.

like image 121
Zeus82 Avatar answered Jan 03 '23 20:01

Zeus82


In my case I needed to declare my Enum as Byte which is the type I was using in the table property with Entity Framework.

Example:

Public Enum DataState As Byte
    Normal=0
    Deleted=1
End Enum
like image 43
Le-roy Staines Avatar answered Jan 03 '23 20:01

Le-roy Staines