Używam Fluent NHibernate i mam dwie tabele:Dołącz do tabeli za pomocą dwóch kolumn non-FK z Fluent NHibernate
BusinessPlan [Id, Year, CustomerCode]
PreviousYearData [Id, Year, CustomerCode, MoreFieldsForData]
w mojej domenie, chcę dołączyć PreviousYearData do biznes planu, aby podmioty coś takiego:
public class BusinessPlan {
public Guid Id { get; set; }
public int Year { get; set; }
public string CustomerCode { get; set; }
public PreviousYearData PreviousYearData {get; set;}
}
public class PreviousYearData {
public Guid Id { get; set; }
public int Year { get; set; }
public string CustomerCode { get; set; }
// many more fields
}
dane w tabeli PreviousYearData zostanie oznakowane na początku tego roku, zanim zostaną utworzone BusinessPlans, więc nie będzie wiedział, co będzie biznes planu identyfikatora i nie można utworzyć normalny klucz obcy. Co myślę, że chcę zrobić, to dołączyć do PreviousYearData do BusinessPlan na podstawie dwóch kolumn Year i CustomerCode. Czy to możliwe dzięki Fluent NHibernate? Czy istnieje inny sposób podejścia do tego, który ma więcej sensu?
Tak. Jeśli tabela FirstYearData jest wypełniona jako pierwsza, dlaczego tabela BusinessPlan nie ma identyfikatora odpowiadającego jej rekordu PreviousYearData? – David