예제 #1
0
        public static void AddColumns <T>(this Projection projection)
        {
            var ids = GetColumnIds <T>();

            foreach (var id in ids)
            {
                if (id == 0)
                {
                    throw new Exception("ColumnId cannot be 0");
                }
                projection.AddColumn(id);
            }
        }
예제 #2
0
        public override IGridDataSource <TEntity> BuildSource(ISession session)
        {
            var projection = new Projection <TEntity>(session);


            if (SelectMode == ProjectionSelectMode.OnlySpecifiedColumns)
            {
                Definition.SelectedAccessors.Each(a => projection.AddColumn(a));
                Definition.Columns.Where(c => c.IsOuterJoin).SelectMany(c => c.SelectAccessors()).Each(a =>
                {
                    alterProjection = p => p.OuterJoin(a);
                });
            }


            _projectionBuilders.Each(x => x(projection));

            return(new ProjectionDataSource <TEntity>(projection, SelectMode));
        }