Exemplo n.º 1
0
        private IEnumerable <ODataEntityDto> SerializeEntities(
            IBindableModelContext context,
            IEnumerable <IEntity> entities,
            IEntityType entityType,
            SelectExpandClause selectExpandClause)
        {
            foreach (var entity in entities)
            {
                var dtoBuilder = this.dtoBuilderFactory.Create(entityType);
                if (selectExpandClause == null || selectExpandClause.AllSelected)
                {
                    SelectAllProperties(dtoBuilder, entity);
                }
                else
                {
                    var selectItemHandler = new DefaultSelectItemHandler(this.entityReader, context, entity, dtoBuilder, SelectAllProperties);
                    selectItemHandler.HandleAll(selectExpandClause.SelectedItems);
                }

                yield return(dtoBuilder.DtoUnderConstruction);
            }
        }