When using ADO.Net Data Model, the MS-generated code for the entities includes the creation of the ObservableCollection navigation properties. I have never had an exception trying to reference the navigation property in this model, presumably because it's been created when the entity was created:
Code: Select all
public partial class BCFuturesExpiration
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public BCFuturesExpiration()
{
this.HistoricalUpdateAttempted = false;
this.BCHistoricalBars = new ObservableCollection<BCHistoricalBar>();
}
Code: Select all
public partial class BCFuturesExpiration {
public BCFuturesExpiration()
{
this.HistoricalUpdateAttempted = false;
this.Intradayupdateattempted = false;
OnCreated();
}
...
/// <summary>
/// There are no comments for BCHistoricalBars in the schema.
/// </summary>
public virtual ObservableCollection<BCHistoricalBar> BCHistoricalBars
{
get;
set;
}
Thanks,
Brian