nPoco - получить один объект с вложенными данными - PullRequest
0 голосов
/ 11 марта 2019

У меня есть два Dto:

[TableName("Address")]
    public class AddressDto
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string City { get; set; }
        public string Street { get; set; }
        public string Building { get; set; }
        public string Appartment { get; set; }
        public string ZipCode { get; set; }
        public string Floor { get; set; }
        public DateTime CreatedDate { get; set; }
    }

[TableName("DistributionPoint")]
    public class DistributionPointDto
    {
        [Column("Id")]
        public int Id { get; set; }

        public string Name { get; set; }

        [Reference(ReferenceType.Foreign, ColumnName = "AddressId", ReferenceMemberName = "Id")]
        public AddressDto Address { get; set; }
    }

Как я могу получить DistributionPointDto с вложенным AddressDto, используя nPoco?У меня есть общий репозиторий для CRUD с методом:

 public T FindById<T>(int id)
        {
           return _db.SingleById<T>(id);
        }

Но, когда я пытаюсь получить DistributionPointDto, AddressDto имеет значение null

...