MongoDB + OData:无法确定表达式的序列化信息:<conditionalexpression> </conditionalexpression>

时间:2013-11-07 23:42:07

标签: c# mongodb kendo-ui mongodb-.net-driver asp.net-web-api-odata

我正在尝试使用KendoUI网格,MongoDB和OData(使用Microsoft.Data.OData)实现一个简单的日志查看器。
“eq”查询适用于日期和字符串,但如果我使用其他类似“substringof”的内容,我会得到一个例外:
Unable to determine the serialization information for the expression: <ConditionalExpression>
完整的堆栈跟踪:http://pastebin.com/UGmwdt0F

这是我使用的代码:

public class LogMessagesController : ODataController
{
    [Queryable(PageSize = 10)]
    public IQueryable<LogMessage> Get()
    {
        IQueryable<LogMessage> container =  Databases.GetLoggingDatabase().GetCollection<LogMessage>("LogMessages").AsQueryable();
        return container;
    }
}

public class LogMessage
{
    [BsonRepresentation(BsonType.ObjectId)]
    public string Id { get; set; }
    public string Message { get; set; }
    public string ProjectName { get; set; }
    public string LogLevel { get; set; }
    public DateTime Timestamp { get; set; }
    public Guid ApiKey { get; set; }
}

0 个答案:

没有答案