我有以下BreezeController:
[BreezeController]
public class FinanceiraController : ApiController
{
readonly EFContextProvider<FinanceiraWS> _contextProvider = new EFContextProvider<FinanceiraWS>();
[HttpGet]
public string Metadata()
{
return _contextProvider.Metadata();
}
..... other functions
[HttpGet]
public List<RegraInfo> RegrasAProcessar(string dataRef, string marcaID)
{
try
{
DateTime data = DateTime.Parse(dataRef);
IQueryable<RegraInfo> lista = _contextProvider.Context.GetRegrasAProcessar(data, marcaID);
return lista.ToList();
}
catch (Exception e)
{
Console.WriteLine(e);
}
return null;
}
}
公开了一个功能&#39; RegrasAProcessar&#39;应该调用 在entityframework edmx文件中公开的sqlserver函数。正如预期的那样,sqlserver函数&#39; GetRegrasAProcessar&#39; 返回我想要发送回客户端的complexType。 客户端又声明了这个代码:
public partial class RegraInfo : BaseComplexObject
{
public Nullable<System.Guid> Id { get {return GetValue<Nullable<System.Guid>>();} set { SetValue(value); } }
public string Conta { get {return GetValue<string>();} set { SetValue(value); } }
public string Natureza { get {return GetValue<string>();} set { SetValue(value); } }
public Nullable<System.DateTime> UltimoProcessamento { get {return GetValue<Nullable<System.DateTime>>();} set { SetValue(value); } }
public Nullable<System.DateTime> DataProcessamento { get {return GetValue<Nullable<System.DateTime>>();} set { SetValue(value); } }
public Nullable<System.DateTime> ProximoProcessamento { get {return GetValue<Nullable<System.DateTime>>();} set { SetValue(value); } }
public Nullable<decimal> Valor { get {return GetValue<Nullable<decimal>>();} set { SetValue(value); } }
public Nullable<double> Qtd { get {return GetValue<Nullable<double>>();} set { SetValue(value); } }
public string Token { get {return GetValue<string>();} set { SetValue(value); } }
public string Parametro { get {return GetValue<string>();} set { SetValue(value); } }
public string MarcaID { get {return GetValue<string>();} set { SetValue(value); } }
public Nullable<System.DateTime> DataInicio { get {return GetValue<Nullable<System.DateTime>>();} set { SetValue(value); } }
public Nullable<System.DateTime> DataFim { get {return GetValue<Nullable<System.DateTime>>();} set { SetValue(value); } }
public string IdPeriodo { get {return GetValue<string>();} set { SetValue(value); } }
public string Descricao { get {return GetValue<string>();} set { SetValue(value); } }
public Nullable<bool> IsToken { get {return GetValue<Nullable<bool>>();} set { SetValue(value); } }
public Nullable<int> Ordem { get {return GetValue<Nullable<int>>();} set { SetValue(value); } }
}
期望将类RegraInfo作为complexObject接收。问题是当我用这段代码调用服务器函数时:
try
{
Dictionary<string, object> parametros = new Dictionary<string, object>();
parametros.Add("dataRef", dataRef.ToShortDateString());
parametros.Add("marcaID", marcaID);
var qry = new EntityQuery<RegraInfo>().From("RegrasAProcessar").WithParameters(parametros);
var results = await manager.ExecuteQuery(qry);
return results.ToList();
}
catch (Exception ex)
{
....
}
给出错误说:&#34;此名称的类型存在,但不是Breeze.Sharp.EntityType&#34;。 这种方法有什么问题?我应该改变什么吗? 我会很感激这个主题的一些帮助。非常感谢提前。