NHibernate allows adding multiple aggregations at the same time for a single ICriteria and generates multiple objects. Below sample shows how this can be achieved
using (var session = _sessionFactory.OpenSession())
{
ICriteria criteria = session.CreateCriteria(typeof(InvoiceLine));
criteria.Add(Restrictions.Where(i => i.Invoice.ID == 1234));
criteria.SetProjection(Projections.ProjectionList()
...
public string aboutme {
var known = { { "C#" , "Javascript" }, { "ASP.NET", "MVC" } };
return known.ToJson();
}
Thursday, 20 October 2011
Wednesday, 19 October 2011
Using NHibernate Criteria with Join to get row count
Google for lot of places for using Criteria object having joins and get rowcount either by using Projections.RowCount or CriteriaTransformer.TransformToRowCount. Now I have started looking into NHibernate source code which does also provides with examples of how to use it.
So the example is as follows :-
public void TransformToRowCountTest()
{
ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
...
Labels:
NHibernate
Wednesday, 12 October 2011
Add or Modify model data before submit in ASP.NET MVC when using jQuery Form Plugin
Having recently started using ASP.NET MVC for a website I am quite impressed the way MVC framework works as opposed to standard ASP.NET web forms.
Also coupled the website with jQuery Form Plugin which works seamlessly with ASP.NET MVC. jQuery Form Plugin basically provides various options such as
beforeSubmit - to validate before submitting data
success - to refresh/update content after success form submition
All works great,...
Labels:
ASP.NET MVC
Subscribe to:
Posts (Atom)