-
Notifications
You must be signed in to change notification settings - Fork 2
queries select projections
Todd Thomson edited this page Sep 7, 2018
·
3 revisions
Entities.Sqlite supports select projections to Data Transfer Objects (DTOs).
public class ProductDto
{
public string ProductDescription { get; set; }
}
var q = from p in context.Products
select new ProductDto
{
ProductDescription = p.Name
};
var result = q.ToList();
public class JoinedProductSuppliers
{
public Product Product { get; set; }
public Supplier Supplier { get; set; }
}
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();