quicktype icon indicating copy to clipboard operation
quicktype copied to clipboard

Support Odata C#

Open faissalMT opened this issue 6 years ago • 1 comments

This would involve:

  • Using ICollections instead of arrays
  • Creating foreign keys e.g: [Column("<TABLE_NAME>_ID")] public virtual int? <CLASSNAME>Id { get; set; }
  • Adding the [Key] public int ID { get; set; } to all classes

Here's an example we cut out of something we're working on:

    public class Milestone2
    {
        [Key]
        public int ID { get; set; }
        public virtual ICollection<KeyMilestone> keyMilestones { get; set; }
        public virtual ExpectedInfrastructureStartOnSite expectedInfrastructureStartOnSite { get; set; }
        public virtual ExpectedCompletionDateOfInfra expectedCompletionDateOfInfra { get; set; }
        public virtual ICollection<AdditionalMilestone> additionalMilestones { get; set; }
        public virtual ICollection<PreviousMilestones> previousMilestones { get; set; }

        // For OData view
        [Column("expectedInfrastructureStartOnSite_ID")]
        public virtual int? ExpectedInfrastructureStartOnSiteId { get; set; }
        [Column("expectedCompletionDateOfInfra_ID")]
        public virtual int? ExpectedCompletionDateOfInfraId { get; set; }
    }

    public class AdditionalMilestone
    {
        [Key]
        public int ID { get; set; }
        public string description { get; set; }
        public string milestoneBaselineCompletion { get; set; }
        public string milestoneSummaryOfCriticalPath { get; set; }

        // For OData view
        [Column("Milestone2_ID")]
        public virtual int? Milestone2Id { get; set; }
    }

Thanks alot, this is a great, unique tool and I appreciate it immensely.

faissalMT avatar Jan 22 '19 15:01 faissalMT