本文整理汇总了C#中MethodCall.Method方法的典型用法代码示例。如果您正苦于以下问题:C# MethodCall.Method方法的具体用法?C# MethodCall.Method怎么用?C# MethodCall.Method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MethodCall
的用法示例。
在下文中一共展示了MethodCall.Method方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMethodCall
public override void VisitMethodCall(MethodCall call)
{
if (call.Method() != null)
{
if ((call.Method().Name.Name == "SendMail" || call.Method().Name.Name == "SendBulkMail") && call.Method().DeclaringType.FullName == "CDS.Core.Utils.EMail")
{
Problems.Add(new Problem(this.GetResolution()));
}
}
base.VisitMethodCall(call);
}
示例2: VisitMethodCall
public override void VisitMethodCall(MethodCall call)
{
if (call.Method() != null)
{
if (call.Method().Parameters.Any(a => a.Type.FullName == "System.Web.Mvc.JsonRequestBehavior"))
{
this.Problems.Add(new Problem(this.GetResolution(), (Node)call));
}
}
base.VisitMethodCall(call);
}
示例3: VisitMethodCall
public override void VisitMethodCall(MethodCall call)
{
if (call.Method() != null)
{
if (call.Method().IsStatic && call.Method().Name.Name.StartsWith("get_Current")
&& call.Method().DeclaringType.FullName != "System.Globalization.CultureInfo")
{
this.Problems.Add(new Problem(this.GetResolution(call.Method().FullName), (Node)call));
}
}
base.VisitMethodCall(call);
}
示例4: VisitMethodCall
public override void VisitMethodCall(MethodCall call)
{
if (IsSqlExecutingFunction(call.Method()))
{
Problems.Add(new Problem(this.GetResolution(), call.SourceContext));
}
if (!call.Method().DeclaringType.FullName.StartsWith("System.") && !call.Method().DeclaringType.FullName.StartsWith("Microsoft.") && call.Method().DeclaringType != _currentType && call.Method().FullName != "CDS.Core.Utils.Inspection.SafeSqlBuilder.#ctor")
{
Problems.Add(new Problem(this.GetResolution(), call.SourceContext));
}
base.VisitMethodCall(call);
}
示例5: VisitMethodCall
public override void VisitMethodCall(MethodCall call)
{
if (call.Method() != null)
{
if (
(call.Method().Name.Name == "Start" && call.Method().DeclaringType.FullName == "System.Threading.Thread")
|| (call.Method().Name.Name == "StartNew" && call.Method().DeclaringType.FullName == "System.Threading.Tasks.Task.Factory")
|| (call.Method().Name.Name == "Start" && call.Method().DeclaringType.FullName == "System.Threading.Tasks.Task")
|| (call.Method().Name.Name == "StartNew" && call.Method().DeclaringType.FullName == "System.Threading.Tasks.TaskFactory")
)
{
Problems.Add(new Problem(this.GetResolution()));
}
}
base.VisitMethodCall(call);
}
示例6: VisitMethodCall
public override void VisitMethodCall(MethodCall call)
{
if (call.Method() != null)
{
if (!call.Method().DeclaringType.DeclaringModule.ContainingAssembly.IsSystemAssembly() //only need to check our own stuff, we can't do data access through a MSFT function from our web projects
&& call.Method().DeclaringType.DeclaringModule.ContainingAssembly.Name != "CDS.Core.Utils" //MOD: we've whitelisted some stuff, here
&& call.Method().DeclaringType.DeclaringModule.ContainingAssembly.Name != "CDS.ProxyFactory"
&& !call.Method().IsPropertyAccessor()) //call me overconfident, but I think we can assume property accessors aren't writing to the database
{
KeywordViolations(call.Method());
}
}
base.VisitMethodCall(call);
}
示例7: IsStringFunction
private bool IsStringFunction(MethodCall call)
{
return IsStringIsh(call.Method().DeclaringType);
}
示例8: IsSafeStringFunction
private bool IsSafeStringFunction(MethodCall call, Node target)
{
if (call.Method().DeclaringType.IsDerivedFrom("CDS.Core.Utils.Inspection.SafeSqlBuilder"))
{
return true;
}
if (!IsSqlGeneratingFunction(call.Method()))
{
if (!IsStringFunction(call))
return false;
if (call.Method().Name.Name == "ToString")
return _dirty.IsSafe(call.Callee);
}
foreach (var op in call.Operands.Where(w => w != target && !IsTypeSafe(w)))
{
var nestedCall = op as MethodCall;
if (nestedCall != null)
{
if (!IsSafeStringFunction(nestedCall, target))
return false;
}
else if (!_dirty.IsSafe(op) && !IsConst(op))
{
return false;
}
}
return true;
}
示例9: VisitMethodCall
public override void VisitMethodCall(MethodCall call)
{
bool safe = true;
var mb = call.Callee as MemberBinding;
if (mb != null)
{
if (IsStringFunction(call))
{
if (!IsSafeStringFunction(call, null))
{
safe = false;
_dirty.MarkDirty(mb.TargetObject, mb.BoundMember, call.SourceContext, false);
}
}
else if (mb.TargetObject != null && !_dirty.IsSafe(mb.TargetObject) && IsStringIsh(call.Type) && !call.Method().DeclaringType.IsDerivedFrom("CDS.Core.Utils.Inspection.SafeSqlBuilder"))
{
safe = false;
_dirty.MarkDirty(call, mb.TargetObject, call.SourceContext, false);
}
}
if (safe)
{
_dirty.MarkSafe(call);
}
if (!IsSqlExecutingFunction(call.Method()) && !IsSqlGeneratingFunction(call.Method()) && !IsSafeStringFunction(call, null) && !IsStringIsh(call.Method().DeclaringType))
{
// mark the reference-type operands as dirty unless it's
// ... executing SQL or building dynamic SQL (those get scanned on the inside)
// ... a string or StringBuilder function. We know that those don't alter their inputs.
foreach (var op in call.Operands.Where(w => w.Type != null && !w.Type.IsValueType && !IsTypeSafe(w.Type)))
{
_dirty.MarkDirty(op, call.Method(), call.SourceContext, false);
}
}
//if the function runs SQL
// an operand's been marked dangerous, PROBLEM!
if (_problemRound && IsSqlExecutingFunction(call.Method()) && _dirty.AnyDirty)
{
var dirty = call.Operands.FirstOrDefault(f => IsStringIsh(f.Type) && !IsConst(f) && !_dirty.IsSafe(f));
if (dirty != null)
{
Problems.Add(new Problem(this.GetResolution(dirty.GetName(), _dirty.GetDirtyDetails(dirty, call, true)), call.SourceContext));
}
}
base.VisitMethodCall(call);
}