c# - Invalid index 6 for this SqlParameterCollection with Count= 6 -


map class

public class cadministratormap : classmap<cadministrator> {      public cadministratormap()     {         table("administrators");          compositeid<cadministratorskey>(c => c.key)             .keyproperty(x => x.client_id, "client_id")             .keyproperty(x => x.start_date, kp => kp.columnname("start_date").type(dbtype.date.tostring()))             .keyproperty(x => x.adm_type, kp => kp.columnname("adm_type").type(dbtype.ansistring.tostring()));          map(x => x.person_id, "person_id").not.insert().not.update();         map(x => x.end_date).column("end_date");         map(x => x.description).column("description").length(200);          references(x => x.person).column("person_id");         references(x => x.cliente).column("client_id");      } } 

i getting following error

invalid index 6 sqlparametercollection count= 6

please help

client id mapped twice, once in cadministratorskey mapping , again in cliente mapping.

remove cliente mapping , change cadministratorskey mapping include reference cliente property shown below:

  compositeid<cadministratorskey>(c => c.key)         .keyreference(x => x.cliente, "client_id") // changed keyreference         .keyproperty(x => x.start_date, kp => kp.columnname("start_date").type(dbtype.date.tostring()))         .keyproperty(x => x.adm_type, kp => kp.columnname("adm_type").type(dbtype.ansistring.tostring()));    // references(x => x.cliente).column("client_id"); removed not needed 

this should remove duplication , fix issue.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -