Otis wrote:
How exactly do you use reflection in combination with nhibernate to create inserts? NHibernate doesn't have an ordinal field in the mappings btw, there's no 'order' in the field mappings according to nhibernate.
Okay i have a manager class for each table 'tablenameManager' which handles CRUD functions for the table, this manager class includes a method called Insert(params with same order as db table columns).
Then i have another general method GeneralInsert(DataRow param) which calls the initializes the table manager class and calls the insert method using reflection based on the Datarow table name so here i pass the method parameters as an object array.
issue is the datarow passed to the general method doesn't always have rows arranged in the rigth way thus the insert method not matching the right parameter signatures.
so what i need is for the entityclass properties to be generated not in the alphabetical order but according to the underlying db table column ordinals so as when ever i receive the datatable object from the Client i check the relevant entityclass properties then based on the
arrangement i will set the datatable column ordinals to set the datarow i send to the general insert method.
The entity field ordering option doesn't solve help me coz the properties are written to file in
an alphabetical order in the entityclasses.