C#C
C#8mo ago
enrico11011

✅ Accessing associated records through navigation properties

say I had a class like so (I'm using them with EF Core)

    public class Project
    {
        public int Id { get; set; }

        [Column(TypeName="VARCHAR(32)")]
        public string Name { get; set; }
        public bool Original { get; set; }
        public int CreatedOn { get; set; }
        public int UpdatedOn { get; set; }
        public int DeletedOn { get; set; }

        public List<FeedbackRecord> FeedbackRecords { get; set; }
        public List<ManufacturingInstructions> ManufacturingInstructions { get; set; }
        public List<ModelPrototype> ModelPrototypes { get; set; }
        public List<Sketch> Sketches { get; set; }
    }


given an instance of
Project
, how would I go about getting the related FeedbackRecords, ManufacturingInstructions, ModelPrototypes, and Sketches? Do I have to go through dbContext? or is there a way to go straight through them model itself (kinda like the way Django does it)?
Was this page helpful?