this throws stack overflow.
public override string ExternalId { set { ExternalId = value; } }
Because you are going into an infinite loop trying to set the property in the setter. If you are going to implement customized setter then you should get rid of auto-implemented property, Define a field and encapsulate that through your property.
For the other question
the base class CANNOT have external id, only some of the derived class use it and need to over ride.
That is why you have proctected access specifier. You can have it as protected
like:
public abstract class MockDataBase
{
private string _ExxternalID;
public virtual string ExxternalID
{
get { return _ExxternalID; }
protected set { _ExxternalID = value; }
}
}
public class UnitMockDataBase : MockDataBase
{
public override string ExxternalID
{
get
{
return base.ExxternalID;
}
protected set
{
base.ExxternalID = value;
}
}
}