Create a DTO with all the properties you need except the image property:
public class YourDTO
{
public string YourProperty1 { get; set; }
public string YourProperty2 { get; set; }
// etc
}
You can then do:
var productDto = context.Products
.Where(x => x.Id == productId)
.Select(x => new YourDTO {
YourProperty1 = x.dbProperty1,
YourProperty2 = x.dbProperty2
// etc, don't include the image column
});
Update:
If you don't want to map the results to YourDTO
, you can project into an anonymous type:
var product = context.Products
.Where(x => x.Id == productId)
.Select(x => new {
x.dbProperty1,
x.dbProperty2
// etc, don't include the image column
});
...and if you want to provide a custom name for each of the properties of the anonymous type:
var product = context.Products
.Where(x => x.Id == productId)
.Select(x => new {
YourProperty1 = x.dbProperty1,
YourProperty2 = x.dbProperty2
// etc, don't include the image column
});