Hi,
this is my problem. I need to read the INFORMATION_SCHEMA.COLUMNS from the SQL Server 2005. I want to map the outcomes to this class:
Code:
class Outcome
{
private string table_name;
private string column_name;
public Outcome()
{
}
public string Table_name
{
get { return table_name; }
set { name = value; }
}
public string Column_name
{
get { return column_name; }
set { name = value; }
}
}
I've used this piece of code to write everything out:
Code:
IList outcomelist= session.CreateSQLQuery("SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS").AddScalar("TABLE_NAME", NHibernateUtil.String).AddScalar("COLUMN_NAME", NHibernateUtil.String).List();
write out with foreach...
But now my question is: how can i map the outcome of CreateSQLQuery to a list of Outcome-objects? Do i need a mapping-file (.hbm.xml) or not?
It's fairly easy to manipulate tables that are created by yourself then read from system tables/views.
Thanks.