views:

24

answers:

1

Tables

  • Departments
  • Employees

I'm trying to associate:

  • Departments - dept_code : char(4)
  • Employees - dept : varchar(4)

But I receive the following error,

Error 2039: The conceptual side property 'DEPT_CODE' has already been mapped to a storage property with type 'char'. If the conceptual side property is mapped to multiple properties in the storage model, make sure that all the properties in the storage model have the same type.

Other than changing the field's data type on the database side... Is there are workaround to this?

A: 

Just change the type. I would also change the name to either dept or dept_code for all tables so that it is consistent.

ipartola
Asking to change a data type (not to mention the name of field) in our accounting system so I could provide a proof of concept isn't feasible at this point. So, going on this - would your answer be that this is not doable in EF?
imlovinit
Most database backends will throw a fit if the data types are not the same. You can usually get around it by using CAST() (http://msdn.microsoft.com/en-us/library/aa226054(SQL.80).aspx). However, I am not sure whether ET or any other ORM will allow you to do that. Another option is to load the list of departments first and do the joining in your application code.
ipartola
Man, this is a bummer. I was drawn to EF via WCF Data Services because it seemed like this allowed consumers of the data service a lot of flexibility in terms of getting the data they want using EF navigation properties. Now it seems whoever consumes the service will have to have "more than basic" linq querying skills.
imlovinit