Return to Snippet

Revision: 27331
at June 2, 2010 22:29 by wearetherock


Initial Code
public static IList<DbTemplateNw> GetDistintTemplateTwo()
        {
            ISession session = ActiveRecordMediator.GetSessionFactoryHolder().CreateSession(typeof(DbTemplateNw));
            ICriteria criteria = session.CreateCriteria(typeof(DbTemplateNw));
            criteria.SetProjection(
                Projections.Distinct(Projections.ProjectionList()
                    .Add(Projections.Alias(Projections.Property("Name"), "Name"))));

            criteria.SetResultTransformer(
                new NHibernate.Transform.AliasToBeanResultTransformer(typeof(DbTemplateNw)));

            IList<DbTemplateNw> result = criteria.List<DbTemplateNw>();
            return result;
        }

Initial URL

                                

Initial Description

                                

Initial Title
Select Distinct with CastleActiveRecord

Initial Tags

                                

Initial Language
C#