Exemplo n.º 1
0
        public ProductReviewRepository(ContentDbContext context)
        {
            this._context = context;

            var provider = new TransformQueryProvider <ProductReviewDTO, ProductReview>(
                dto => new ProductReview()
            {
                Id = dto.Id, Rating = dto.Rating, Timestamp = dto.ContentItem.Timestamp, Author = dto.ContentItem.Author, Review = dto.Review
            },
                context.ProductReviewDTOs
                );

            provider.AddMapping(b => b.Id, dto => dto.Id);
            provider.AddMapping(b => b.Timestamp, dto => dto.ContentItem.Timestamp);
            provider.AddMapping(b => b.Author, dto => dto.ContentItem.Author);
            provider.AddMapping(b => b.Rating, dto => dto.Rating);
            provider.AddMapping(b => b.Review, dto => dto.Review);

            _transformedQueryable = provider.CreateEmptyQuery();
        }
Exemplo n.º 2
0
        public BlogPostRepository(ContentDbContext context)
        {
            this._context = context;

            var provider = new TransformQueryProvider <BlogPostDTO, BlogPost>(
                dto => new BlogPost()
            {
                Id = dto.Id, Title = dto.Title, Timestamp = dto.ContentItem.Timestamp, Author = dto.ContentItem.Author, Content = dto.Content
            },
                context.BlogPostDTOs
                );

            provider.AddMapping(b => b.Id, dto => dto.Id);
            provider.AddMapping(b => b.Content, dto => dto.Content);
            provider.AddMapping(b => b.Title, dto => dto.Title);
            provider.AddMapping(b => b.Author, dto => dto.ContentItem.Author);
            provider.AddMapping(b => b.Timestamp, dto => dto.ContentItem.Timestamp);

            _transformedQueryable = provider.CreateEmptyQuery();
        }