Consider below code:
namespace Domain.Models;
public partial class Class1
{
//Other properties
[IgnoreDataMember]
public virtual ICollection<Activity> Activities { get; set; }
}
public partial class Class2
{
//Other properties
[IgnoreDataMember]
public virtual ICollection<Activity> Activities { get; set; }
}
adding [IgnoreDataMember] to public virtual ICollection<...> in each class, is a repetitive task (Consider the large number of these repetitive tasks in a large project)!
Is there any clean solution that works like this proposition: "Add [IgnoreDataMember] to all virtual ICollection properties"?


