I'm using Simple.Data but can't seem to get it to fully populate my related objects from a single query. I've checked some of the other questions on StackOverflow but nothing has so far been successful.
I have objects:
public class ProductVersion
{
public int VersionId { get; set; }
public int ModelId { get; set; }
public int VariantId { get; set; }
public int MarketId { get; set; }
public DateTime? FileDate { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
public int RevisionId { get; set; }
public Model Model { get; set; }
public Variant Variant { get; set; }
public Market Market { get; set; }
}
public class Model
{
public int ModelId { get; set; }
public string Description { get; set; }
}
public class Variant
{
public int VariantId { get; set; }
public string Description { get; set; }
}
public class Market
{
public int MarketId { get; set; }
public string Description { get; set; }
public int LanguageId { get; set; }
public Language Language { get; set; }
}
public class Language
{
public int LanguageId { get; set; }
public string Description { get; set; }
}
( ProductVersion has a Model, Variant and Market, and Market has a Language )
Then, I'm attempting to retrieve a single instance of ProductVersion using:
ProductVersion instance = db
.ProductVersion
.With(db.ProductVersion.Model)
.With(db.ProductVersion.Variant)
.With(db.ProductVersion.Market)
.With(db.ProductVersion.Market.Language)
.Get(1);
;
I get an instance of ProductCatalogVersion returned, with Model, Variant, and Market properties populated but Market.Language is null. I can see the correct joins being issued in the SQL and the Language table is being read I just can't get it to populate the Language property of Market.
Any help greatly appreciated.
Simple.Data doesn't support the hydrating of grandchild tables into a POCO. Thus the Language table doesn't work while the others do. I believe that this feature is planned for support in the v2 timeline but when exactly it will be implemented is up in the air.