I have to access a set of stored procedures via NHibernate.
One of these stored procedures returns a result, however the columns returned are different based on the parameters passed in.
For example if I pass in the dates 01/01/2014 and 01/01/2015 I might get the results
column1, column2, column3
However if I pass in a different date range the stored procedure may return a different set of columns e.g.
column1, column2, column3, column4, column5, column6
How can I map this to an entity?
Is it possible to somehow have a map that maps all the columns that could possibly come back and then just set the properties as null if the column does not come back from the stored procedure?
public class ModelMap : ClassMap<Model>
{
public ModelMap()
{
this.ReadOnly();
this.Id(x => x.Date);
this.Map(x => x.Column1)
this.Map(x => x.Column2)
this.Map(x => x.Column3)
this.Map(x => x.Column4)
this.Map(x => x.Column5)
this.Map(x => x.Column6)
}
}
Any ideas on how I could get this type of stored procedure to map to an entity?