Map data type "name" in entity framework

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Posts: 2
Joined: Wed 24 Aug 2011 13:47

Map data type "name" in entity framework

Post by asowmyan » Fri 14 Oct 2011 15:22


I have a view that gets the users from pg_user (field name usename) view with some filter condition. I am trying to map this view in entity framework and I am getting an error saying name datatype cannot be mapped. I tried to cast the name type to text but postgresql doesnt accept that cast. Is there any other way to get this done?


Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 20 Oct 2011 08:39

There is a general rule: any data type can be used in Entity Framework if the database allows to work with the data type in the way like it works with a primitive type.

So if some "advanced" type can be read as byte array (or string or int etc) and be successfully inserted in the same way, there is a common solution:
- import table in the model within Entity Developer
- change the data type of the "advanced" column in SSDL to the corresponding primitive database data type (which is supported)
- adjust the "advanced" column data type in CSDL (set it to the corresponding .NET type)

If the "advanced" type cannot be treated as a primitive type, there is no possibility to use it in Entity Framework.

Post Reply