我正在使用Dapper(感谢Sam,很棒的项目.)带有DAL的微型ORM,由于某种原因,我无法使用输入参数执行存储过程.
在示例服务中,我有以下代码:
public void GetSomething(int somethingId)
{
IRepository<Something, SomethingEnum> repository = UnitOfWork.GetRepository<Something, SomethingEnum>();
var param = new DynamicParameters();
param.Add("@somethingId", dbType: DbType.Int32, value:somethingId, direction: ParameterDirection.Input);
var result = repository.Exec<Something>(SomethingEnum.spMyStoredProcedure, param);
...
}
Run Code Online (Sandbox Code Playgroud)
当触发执行存储过程时,抛出SqlException声明我需要提供'somethingId'
过程或函数'spMyStoredProcedure'需要参数'@somethingId',这是未提供的.
我的DAL类似于Pencroff的这个github项目.
我在这里错过了什么吗?
更新:我实际上是通过SomethingEnum传递commandType:
public class SomethingEnum : EnumBase<SomethingEnum, string>
{
public static readonly SomethingEnum spMyStoredProcedure = new SomethingEnum("spMyStoredProcedure", "[dbo].[spMyStoredProcedure]", CommandType.StoredProcedure);
public SomethingEnum(string Name, string EnumValue, CommandType? cmdType): base(Name, EnumValue, cmdType)
{
}
}
Run Code Online (Sandbox Code Playgroud) 给定以下架构字段:
<field indexed="true" stored="true" name="Status" type="int" />
<field indexed="true" stored="true" name="StatusDate1" type="tdate" />
<field indexed="true" stored="true" name="StatusDate2" type="tdate" />
Run Code Online (Sandbox Code Playgroud)
在给定当前每日日期和StatusDate1和StatusDate2字段的情况下,solr是否可以处理Status的计算?
例如:某个对象包含(忽略sintax)StatusDate1:2016年1月9日,StatusDate2:5/9/2016,知道今天是9/9/2016预期输出将是Status = 2.
此状态是根据每个对象的当前日期和StatusDate字段计算的.我想刻面的状态字段.
是函数查询要走的路?或者我需要在索引时处理这个问题吗?(每天索引的任务看似虚假)解决这个问题的最佳方法是什么?
注意:我的solr版本是4.6.0
我正在运行umbraco 7的实例.但我似乎无法设置miniprofiler来使用它.
在我的global.asax上设置它:
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
Run Code Online (Sandbox Code Playgroud)
还定义了web.config上的处理程序:
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
Run Code Online (Sandbox Code Playgroud)
真的很感激任何帮助.