linq - Error - Corresponding column type must be compatible - DateTime field - Entity Framework, Informix, Load multiple childs -
environment: entity framework 5.0 .net 4.0 informix (ids) ibm info server client 9.7
i trying retrieve more 1 kid tables info using linq entities: ex:- var res = dbcontext.commercial_invoice.include(x=>x.cmrcl_invc_line_item).include(y=>y.cmrcl_invc_contact);
here entity framework generated database query (other columns omitted simplicity):-
(select extent1.cmrcl_invc_id cmrcl_invc_id ,extent2.last_change_ts last_change_ts1 "informix".commercial_invoice extent1 left outer bring together "informix".cmrcl_invc_line_item extent2 on extent1.cmrcl_invc_id = extent2.cmrcl_invc_id cast(366 int) = extent1.cmrcl_invc_id) union (select extent3.cmrcl_invc_id cmrcl_invc_id ,cast(null datetime year fraction(5)) c21 "informix".commercial_invoice extent3 inner bring together "informix".cmrcl_invc_contact extent4 on extent3.cmrcl_invc_id = extent4.cmrcl_invc_id cast(366 int) = extent3.cmrcl_invc_id);
while executing query getting "corresponding column types must compatible each union statement". when alter query : cast(null datetime year fraction(5)) cast(null datetime year second), executed without error.
in database last_change_ts column type datetime.
it seems entity framework using "year fraction(5)" casting default.
any ideas/suggestions solve this.
thanks in advance, phani
in class definition cmrcl_invc_line_item
, can seek manually specifying database info type last_change_ts
property using column
attribute. example:
[column(typename="datetime year second")] public datetime last_change_ts {get; set;}
that should alter type used in generated query.
linq entity-framework datetime informix children
No comments:
Post a Comment