我正在通过继承RolesService来扩展一个新类.在RolesService中,我有一个静电方法,我希望在新派生的类中覆盖该方法.当我从派生对象进行调用时,它不使用被覆盖的静电方法,它实际上调用基类方法.有什么主意吗?
public class RolesService : IRolesService
{
public static bool IsUserInRole(string username, string rolename)
{
return Roles.IsUserInRole(username, rolename);
}
}
public class MockRoleService : RolesService
{
public new static bool IsUserInRole(string username, string rolename)
{
return true;
}
}