我发现问题时遇到了问题。它给我一个错误信息:
"非静态方法需要目标。"
我的代码如下:
private void test(RightComponent rc)
{
if (rc != null)
{
var t = (from c in _repository.All<CadastralObject>()
where c.Id == rc.CadastralObjectId && rc.Type.Code == "jointpossession"
select rc.Type.Code);
if (t.ToString() == rc.Type.Code && (rc.SharedQuotaNumerator != null || rc.SharedQuotaDenominator != null))
throw new BusinessException("Smund te shkruani per kete lloj");
}
}