You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to exclude certain properties from the SQL that is fetched without having to inclusively add each property I want in a .Select()
Example:
// Model
public class Product {
public int Id {get;set;}
public string Name {get;set;}
public string BigBloatedJson {get;set;}
}
// Exclude BigBloatedJson property to get (select Id, Name from Product where Id =@Id)
dbContext.Product.Where(x => x.Id == Id).ExcludeProperty(x => x.BigBloatedJson).FirstOrDefault();
// Instead of what you have to do now
dbContext.Product.Where(x => x.Id == Id).Select(x => new Product {Id = x.Id, Name = x.Name}).FirstOrDefault();
In this simple example I only have a couple properties. But in a larger entity and one that make have base class inheritance it becomes much more tedious.
Is this even possible with the current architecture? Has anyone done it? Is there a better way?
The text was updated successfully, but these errors were encountered:
I would like to be able to exclude certain properties from the SQL that is fetched without having to inclusively add each property I want in a .Select()
Example:
In this simple example I only have a couple properties. But in a larger entity and one that make have base class inheritance it becomes much more tedious.
Is this even possible with the current architecture? Has anyone done it? Is there a better way?
The text was updated successfully, but these errors were encountered: