我正在开发一个框架,其中我是一个动态创建参数的调用存储过程.我正在运行时构建参数集合.
当我将参数传递给存储过程时,会出现问题,但存储过程不接受此类参数.
例如,我的存储过程是:
CREATE PROCEDURE GetTaskEvents
@TaskName varchar(50)
AS
BEGIN
-- SP Logic
END
Run Code Online (Sandbox Code Playgroud)
将存储过程称为:
EXEC GetTaskEvents @TaskName = 'TESTTASK', @ID = 2
Run Code Online (Sandbox Code Playgroud)
这会抛出以下错误:
Msg 8144, Level 16, State 2, Procedure GetTaskEvents, Line 0
Procedure or function GetTaskEvents has too many arguments specified.
Run Code Online (Sandbox Code Playgroud)
这在Sybase ASE中运行良好,它只是忽略任何其他参数.这可以用MSSQL server 2008实现吗?任何帮助,非常感谢.谢谢
我试图通过Autofac了解委托工厂模式.我知道如何使用带有Keyed()注册的IIndex <>来实现工厂,这里很好地解释了:配置在抽象类上定义的Autofac委托工厂
我想知道是否可以使用Func <>创建工厂,我将如何为以下示例进行注册:
public enum Service
{
Foo,
Bar
}
public interface FooService : IService
{
ServiceMethod();
}
public interface BarService : IService
{
ServiceMethod();
}
public class FooBarClient
{
private readonly IService service;
public FooBarClient(Func<Service, IService> service)
{
this.service = service(Service.Foo);
}
public void Process()
{
service.ServiceMethod(); // call the foo service.
}
}
Run Code Online (Sandbox Code Playgroud) 我正在努力在log4net中编写一个AND条件过滤器.如果它是nLog,我可以这样写:
<logger name="*" minlevel="Info" xsi:type="NLogLoggerRule" writeTo="FooLogger" >
<filters>
<when condition="equals('${event-context:item=UserID}', 'TESTUSER')
and equals('${event-context:item=URL}','/foo/foobar.aspx')"
action="Ignore" />
</filters>
</logger>
Run Code Online (Sandbox Code Playgroud)
我不知道如何在log4net中编写相同的过滤器.在写一个条件时,我迄今为止取得了成功:
<appender>
....
<filter type="log4net.Filter.PropertyFilter">
<key value="URL" />
<stringToMatch value="/foo/foobar.aspx" />
<acceptOnMatch value="false" />
</filter>
</appender>
Run Code Online (Sandbox Code Playgroud)
如何使用log4net过滤器编写AND条件?请帮忙.
我是Rx的新手并希望在我当前的项目中使用它.我正在尝试实现文件观察系统.至少我现在只对文件创建活动感兴趣.但是当我尝试在代码下运行时,我得到"值不能为空错误消息".请有人帮我解决下面的代码.
class Program
{
static void Main(string[] args)
{
IDisposable writer = new FileSystemObservable(@"D:\Code\Rx\Dropbox\", "*.*", false)
.CreatedFiles
.Where(x => (new FileInfo(x.FullPath)).Length > 0)
.Select(x => x.Name)
.Subscribe(Console.WriteLine);
Console.ReadLine();
}
}
class FileSystemObservable
{
private readonly FileSystemWatcher fileSystemWatcher;
public FileSystemObservable(string directory, string filter, bool includeSubdirectories)
{
fileSystemWatcher = new FileSystemWatcher(directory, filter)
{
EnableRaisingEvents = true,
IncludeSubdirectories = includeSubdirectories
};
CreatedFiles = Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>
(h => fileSystemWatcher.Created += h,
h => fileSystemWatcher.Created -= h)
.Select(x => new { x.EventArgs }) as IObservable<FileSystemEventArgs>; …Run Code Online (Sandbox Code Playgroud) 我最近开始了一个使用大量客户端jQuery / javascripts的项目。我正在努力使其中一个屏幕正常工作。
我有如下功能:
function init{
populateTypes();
populateGroups();
populateStatuses();
applyCurrentUserSettings();
}
Run Code Online (Sandbox Code Playgroud)
所有populate*方法都会$.ajax对服务器进行ajax调用(),并在视图上添加一些复选框列表。applyCurrentUserSettings方法还会发出ajax请求,并在视图上设置当前用户选择。
问题是populate*方法是异步的,并且由applyCurrentUserSettings方法调用,复选框列表为“有时”为空,apply方法失败。
我可以通过传递得到这个工作async: false的$.ajax电话,或链条内的另一个每个Ajax调用,但我想知道,如果有任何更好的方法/设计模式来处理这样的情况。