Wiki Link: [discussion:5322]
"Invalid Cast" errors 

Jul 17 2012 at 5:58 PM
If you get these errors, I found it just means that one of the columns being returned by the data source (stored procedure or otherwise) is not compatible with one of the the properties of the given entity's CLR data type. In my case, BIGINT (long in the CLR) was not implicitly convertible to the CLR type 'int'; Took me a while to figure out, hopefully this helps someone, cheers!

ps. I hope a better, more meaningful, error can be thrown in a future version.

Dec 5 2013 at 8:46 PM
Edited Dec 5 2013 at 8:49 PM
Hi, can you please specify from where (URL / source) did you look these mappings up. I'm also getting the type cast exception in Materialize.cs. I have Oracle 11g DB, and my mappings between Oracle, and CLR seem fine. Thanks!

SSDL:
<Property Name="ID" Type="number" Nullable="false" StoreGeneratedPattern="Identity" Precision="10" />
<Property Name="PATH" Type="nvarchar2" MaxLength="2000" />
<Property Name="COLLECTION" Type="number" Nullable="false" Precision="1" />
<Property Name="TYPE" Type="number" Nullable="false" Precision="10" />
<Property Name="RULETYPE" Type="number" Nullable="false" Precision="10" />

CSDL:
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
<Property Type="String" Name="Path" MaxLength="2000" FixedLength="false" Unicode="true" />
<Property Type="Boolean" Name="Collection" Nullable="false" />
<Property Type="Int32" Name="TypeInt" Nullable="false" a:GetterAccess="Public" a:SetterAccess="Public" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" />
<Property Type="Int32" Name="RuleTypeInt" Nullable="false" a:GetterAccess="Public" a:SetterAccess="Public" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" />


Updating...
Page view tracker