c# - How to solve this exception "Could not find a setter for property 'ProductCode' in class ... " -


i getting following exception:

"could not find setter property 'productcode'in class ...orderitem.class " 

the property (productcode) 1 of table keys.

see how property declaration in class.

public class orderitem : entitybase {     public virtual short company { get; set; }     public virtual int order { get; set; }     public virtual string seri { get; set; }     public virtual string productcode { get; set; }     public virtual string crop { get; set; }  .  .  .  } 

below mapping.

public maporderitem()     {         table("iped");         compositeid()             .keyproperty(c => c.company, "c_emp")             .keyproperty(c => c.order, "p_ped")             .keyproperty(c => c.seri, "s_ped")             .keyproperty(c => c.productcode, "c_psv");         map(c => c.c_cfo).not.nullable();         map(c => c.anothercurrency).column("v_ipe");     .     .     .     } 

checked doubts similar mine, solutions not solve problem. tried perform mapping using

(c => c.productcode).access.readonly(); (c => c.productcode).access.field(); (c => c.productcode).readonly(); 

to run query directly in database, not show me error, correct data.

solution

if executing sql nhibernate, verify alias name of column in sql. name should name property in class.


e.g. incorrect:

select product_id "productcode "  products 

see white space in alias name. can cause of error.

check alias name columns in sql.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -