EF has some problems.
Environment: EntityFramework version: 4.1.0.0
Question 1: "data reader and specified"..." Incompatible. A type is "..." .".
Usage: rep. context. Database. SqlQuery <T> (SQL, pList. ToArray <object> (); // SQL concatenates strings directly.
Cause: T is a view, because the fields in the database have the prefix "C _", and we performed the prefix operation when producing the object. As a result, the field does not match.
Solution: When spelling an SQL string, remove the prefix field from the alias. For example, C_DISP_TYPE_NM as DISP_TYPE_NM.
Problem 2: The "MAIN_STAT" attribute of "V_CLAIM_DISPATCH" cannot be set to "Int64. You must set this attribute to a non-null value of the type "Int32"
Usage: var surveyList = claimBiz. FindAll <V_CLAIM_DISPATCH> (sqlText, pList );
Cause: [UNKNOWN] the possible cause is that the database is number (10) and the generated entity is int. The actually read data corresponds to int64. However, the EF ing of that field type is automatically completed by EF and cannot be manually modified. So an error is reported.
Solution: write a new class V_CLAIM_DISPATCH_COPY flag field Nullable <Int64> MAIN_STAT. In the above method, var surveyList = claimBiz. FindAll <V_CLAIM_DISPATCH_COPY> (sqlText, pList); change the generic type to a custom class.