我正在使用一个公共实体框架, ParentClass
它function
通过搜索配置和数据库条目来做很多重要的事情,并且无法编辑此代码,因为它来自第三方。但是,我想function
在ParentClass
无法访问的白名单信息上添加额外的“搜索”。
下面的代码是正在发生的事情的模型。我只是想知道,有没有更好的方法来扩展ParentClass
和访问它function
public ParentClass : ClassInterface
{
foo bar;
public Parent(foo _bar)
{
this.bar = _bar
}
function(int)
{
// do things with this.bar
}
}
public ChildClass : ParentClass, ClassInterface
{
public ChildClass(foo _bar) : base(_bar) { }
public virtual function(int)
{
bool x = base.function(int)
if (!x)
{
... stuff
}
... otherstuff
}
}