alex,
as an aside, how would the nH stuff work (given the lack of sql) in genrating paged resultsets. i'm thinking in particular of the type of thing that i use a lot where you use ROW_NUMBER() OVER (ORDER BY {0}) as well as ordering by columns (as generated by the gridview.
it's the flexibility of being able to use these 'tricks' that makes the DAL (especially if templated) a pretty comfotable zone for me. i've pasted my amended version of the sqlclient articles List, just to give an idea of what i'm struggling to imagine being replaced with just the table definitions in nH:
public override List<ArticlesEntity> GetArticles(string sortExpression, int startRowIndex, int maximumRows)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
string SQLString = "SELECT TOP(@End) * FROM ("
+ string.Format("SELECT *, ROW_NUMBER() OVER (ORDER BY {0}) AS RowNum FROM tbh_Articles",
sortExpression != "" ? sortExpression : "ArticleID ASC")
+ ") AS Alltbh_Articles WHERE RowNum BETWEEN @Start AND @End ORDER BY RowNum ASC";
SqlCommand cmd = new SqlCommand(SQLString, cn);
cmd.Parameters.Add("@Start", SqlDbType.Int).Value = startRowIndex + 1;
cmd.Parameters.Add("@End", SqlDbType.Int).Value = startRowIndex + maximumRows;
cn.Open();
return this.GetArticlesCollectionFromReader(ExecuteReader (cmd));
}
}
anyway, good to think about this stuff.
jimi
http://www.originaltalent.com