小编Dev*_*low的帖子

在SQL 2008 Management Studio中调试时查询存储过程中的临时表

我有一个非常大的存储过程调用其他存储过程并将结果应用于临时表.

我在SQL 2008 Management Studio中进行调试,可以使用监视窗口查询本地参数,但是如何在调试时查询临时表?

如果不可能有另一种方法吗?我已经阅读过有关使用表变量的信息,是否可以查询这些变量?如果是这样,我该怎么做?

sql debugging stored-procedures

20
推荐指数
2
解决办法
1万
查看次数

在 Mediatr 行为管道中进行验证

我在我的 web api 2 项目中使用 Mediatr 4。连同 FluentValidation 和 Unity,我一直在添加一个管道行为来验证我的请求。

public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
    where TRequest : IRequest<TResponse>
{
    private readonly IEnumerable<IValidator<TRequest>> _validators;

    public ValidationBehavior(IEnumerable<IValidator<TRequest>> validators)
    {
        _validators = validators;
    }

    public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
    {
        var context = new ValidationContext(request);
        var failures = _validators
            .Select(v => v.Validate(context))
            .SelectMany(result => result.Errors)
            .Where(f => f != null)
            .ToList();

        if (failures.Count != 0)
        {
            throw new ValidationException(failures);
        }
        return next();
    }
}
Run Code Online (Sandbox Code Playgroud)

这一切都很好,但我真的希望能够在打包的响应中返回验证。我正在努力进行这样的更改,要么让它编译,要么没有 Unity 抛出运行时解决问题。 …

c# unity-container fluentvalidation mediatr

5
推荐指数
1
解决办法
2599
查看次数

c#.Net CF Form.Invoke引发ArgumentException

我从以下代码接收ArgumentException,我很难理解堆栈跟踪中的最后一个条目是

System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr,
                Binder binder, Object[] parameters, CultureInfo culture, 
                Boolean verifyAccess, StackCrawlMark& stackMark)
Run Code Online (Sandbox Code Playgroud)

当我逐步完成DeviceResponse时,按照我的预期填充并且目标位于并且符合预期,但每次都会抛出targetForm.Invoke

任何帮助将非常感激.

该事件定义为:

public static event EventHandler<MsgEventArgs<DeviceResponse>> DeviceResponseReceived;
Run Code Online (Sandbox Code Playgroud)

该代码正在引发该事件:

//Raise the event
if (DeviceResponseReceived != null)
{
    if (DeviceResponseReceived.Target is System.Windows.Forms.Form)
    {
         System.Windows.Forms.Form targetForm = DeviceResponseReceived.Target as System.Windows.Forms.Form;
         targetForm.Invoke(DeviceResponseReceived, new MsgEventArgs<DeviceResponse>(deviceResponse));
    }
}
Run Code Online (Sandbox Code Playgroud)

MsgEventArgs是从EventArgs派生的通用事件参数类:

public class MsgEventArgs<T> : EventArgs
{
    public MsgEventArgs(T value)
    {
        m_value = value;
    }
    private T m_value;
    public T Value
    {
        get { return m_value; }
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的表单中,我已在表单构造函数中注册了该事件:

DeviceResponse.DeviceResponseReceived += …
Run Code Online (Sandbox Code Playgroud)

c# events user-interface compact-framework invoke

1
推荐指数
1
解决办法
1446
查看次数