Updated
What is the best way to setup this class? i.e. call the SetupInstruction()
method? I want to make this method virtual so a class that overrides can have its own implementation. In the overridden class I will set up other objects/properties.
public abstract class InstructionInfo : IInstruction
{
protected readonly IUserSession UserSession;
protected readonly IReadOnlySession ReadOnlySession;
protected InstructionInfo(int instructionID)
{
InstructionID = instructionID;
}
protected virtual void SetupInstruction()
{
_myInstruction = null; //call db and set up...
}
#region interface members
private Instruction _myInstruction;
public Instruction MyInstruction
{
get
{
**SetupInstruction();**
return _myInstruction;
}
private set { _myInstruction = value; }
}
#endregion
}