This project is read-only.

Two content types, join in code

Topics: Writing modules
Jul 14, 2013 at 2:05 PM
i have three content types an applicationRecord, an ApplicationDetailRecord and a CustomerPartRecord, my applicationRecord looks like:
        public virtual int Id { get; set; }
        public virtual int CustomerId { get; set; }
        public virtual DateTime CreatedAt { get; set; }
        public virtual ApplicationStatus Status { get; set; }
        public virtual CustomerPartRecord customer { get; set; }
        public virtual IList<ApplicationDetailRecord> Details { get; protected set; }
now in my applicationService i have a getApplications() function like so:
        public IQueryable<ApplicationRecord> GetApplications()
                    return _applicationRepository.Table;
when this runs it is returning all ApplicationDetailRecords but not the CustomerRecord. I also have two foreign key defined in my migration file which are
            SchemaBuilder.CreateForeignKey("Application_Customer", "ApplicationRecord", new[] { "CustomerId" }, "CustomerPartRecord", new[] { "Id" });
            SchemaBuilder.CreateForeignKey("ApplicationDetail_Application", "ApplicationDetailRecord", new[] { "ApplicationRecord_Id" }, "ApplicationRecord", new[] { "Id" });
i cant see any reason why the customer record isnt being returned, am i missing anything? how would i get this working?
Jul 14, 2013 at 9:31 PM
I think the CustomerId column in the ApplicationRecord table needs to be Customer_Id.