Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Select Projections #15

Open
ToddThomson opened this issue Sep 6, 2018 · 1 comment
Open

Support Select Projections #15

ToddThomson opened this issue Sep 6, 2018 · 1 comment
Assignees
Milestone

Comments

@ToddThomson
Copy link
Member

Feature to be added to alpha release.

@ToddThomson ToddThomson added this to the Beta Release milestone Sep 6, 2018
@ToddThomson ToddThomson self-assigned this Sep 6, 2018
@ToddThomson ToddThomson changed the title Support Projections Support Select Projections Sep 7, 2018
@ToddThomson
Copy link
Member Author

Select projections are now supported.

Domain Objects

public class ProductDto
{
    public string ProductDescription { get; set; }
}

public class JoinedProductSuppliers
{
    public Product Product { get; set; }
    public Supplier Supplier { get; set; }
}

Select Projection to DTO

var q = from p in context.Products
             select new ProductDto
             {
                 ProductDescription = p.Name
             };

var result = q.ToList();

Select Projection to DTO with Join

var q = from p in context.Products
             join s in context.Suppliers on p.Id equals s.Id
             select new JoinedProductSuppliers
             {
                 Product = p,
                 Supplier = s
              };

var result = q.ToList();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant