public CountryCurrencyObject(CountryCurrencyDbRecord dbRecord) : base(dbRecord) { DbRecord.Country = DbRecord.Country ?? new CountryDbRecord(); DbRecord.Currency = DbRecord.Currency ?? new CurrencyDbRecord(); Country = new CountryObject(DbRecord.Country); Currency = new CurrencyObject(DbRecord.Currency); }
public static CountryCurrencyObject Create(CountryObject country, CurrencyObject currency, DateTime?validFrom = null, DateTime?validTo = null) { var o = new CountryCurrencyDbRecord { Country = country?.DbRecord ?? new CountryDbRecord(), Currency = currency?.DbRecord ?? new CurrencyDbRecord(), ValidFrom = validFrom ?? DateTime.MinValue, ValidTo = validTo ?? DateTime.MaxValue }; o.CountryID = o.Country.ID; o.CurrencyID = o.Currency.ID; return(new CountryCurrencyObject(o)); }