Skip to content

Don't require all foreign key back references to be satisifed. #12

@bartread

Description

@bartread

E.g., this can cause a problem:

    [Table("[cust].[MERCHANT_LEGAL_INFO_TRN]")]
    public class MerchantLegalInfoDto : BaseGoofyAuditableTrn
    {
        [PrimaryKey]
        public int? MerchantLegalInfoKey { get; set; }

        [ForeignKeyReference(typeof(MerchantMasterDto))]
        public Guid? MerchantGuid { get; set; }

        [ManyToOne]
        [ForeignKeyReference(typeof(FullAddressDto))]
        [Column("AddressGuid")]
        public FullAddressDto Address { get; set; }

        [ManyToOne]
        [ForeignKeyReference(typeof(ContactMasterDto))]
        [Column("ContactGuid")]
        public ContactMasterDto Contact { get; set; }

        public int BusinessLegalTypeKey { get; set; }

        public string RegisteredName { get; set; }

        [DateIsNullOrInThePast]
        public DateTime? CompanyStartDate { get; set; }

        [DateIsNullOrInThePast]
        public DateTime? CompanyRegistrationDate { get; set; }

        public string CompanyRegistrationNumber { get; set; }

        public string RegisteredCharityNumber { get; set; }

        public string VATNumber { get; set; }

        public bool IsCurrent { get; set; }
    }

Specifically, if you want to use this DAO in a query that doesn't involve a MerchantMasterDto it will throw an error because it can't find a JOIN target for the MerchantGuid column/property.

Ideally it would either ignore this or, at worst, issue a warning. The latter may not even be necessary. You really want to be able to use DAOs in queries as flexibly as possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions