Beispiel #1
0
        public IList <Competition> GetByPlayer(long id)
        {
            Competition dto  = null;
            Competition comp = null;
            Game        game = null;
            PlayerStats ps   = null;

            using (ISession session = NHibernateHelper.OpenSession())
            {
                var comps = session.QueryOver <PlayerStats>(() => ps)
                            .JoinAlias(() => ps.Game, () => game)
                            .JoinAlias(() => game.Competition, () => comp)
                            .Where(e => e.Player.Id == id)
                            .SelectList(l => l
                                        .Select(() => comp.Id).WithAlias(() => dto.Id)
                                        .Select(() => comp.Name).WithAlias(() => dto.Name)
                                        .Select(() => comp.Team).WithAlias(() => dto.Team)
                                        )
                            .TransformUsing(Transformers.AliasToBean <Competition>())
                            .List <Competition>();
                return(comps as IList <Competition>);
            }
        }