我创建了一个新查询,当我尝试预览它时,我收到以下错误。
我点击此链接并创建了一个内容类型 Book 并将内容部分产品添加到其中。
http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-5
无法执行查询
[ 选择不同的 TOP (@p0) contentite0_.Id 作为 col_0_0_ 从 Orchard_Framework_ContentItemVersionRecord contentite0_ 内部连接 Orchard_Framework_ContentItemRecord contentite1_ on contentite0_.ContentItemRecord_id=contentite1_.Id 内部连接 Customer_ProductPartRecord productpar2_ on contentite1_.Id=productpar2_.Id 其中 contentite0_.Published=1 按 contentite0_ 排序。 ID ]
[SQL: select distinct TOP (@p0) contentite0_.Id as col_0_0_ from Orchard_Framework_ContentItemVersionRecord contentite0_ 内连接 Orchard_Framework_ContentItemRecord contentite1_ on contentite0_.ContentItemRecord_id=contentite1_.Id 内连接 Customer_ProductPartRecord productpar2_ on contentite1_.Id=productpar2_.Id where contentite0_.Published=1 order by contentite0_.Id]
**ProductPartFilter.cs**
using Orchard.Localization;
using Orchard.Projections;
using Orchard.Projections.Descriptors.Filter;
using Skywalker.Webshop.Models;
using IFilterProvider = Orchard.Projections.Services.IFilterProvider;
namespace Skywalker.Webshop.Filters
{
public class ProductPartFilter : IFilterProvider
{
public Localizer T { get; set; }
public ProductPartFilter()
{
T = NullLocalizer.Instance;
}
public void Describe(DescribeFilterContext describe)
{
describe.For(
"Content", // The category of this filter
T("Content"), // The name of the filter (not used in 1.4)
T("Content")) // The description of the filter (not used in 1.4)
// Defines the actual filter (we could define multiple filters using the fluent syntax)
.Element(
"ProductParts", // Type of the element
T("Product Parts"), // Name of the element
T("Product parts"), // Description of the element
ApplyFilter, // Delegate to a method that performs the actual filtering for this element
DisplayFilter // Delegate to a method that returns a descriptive string for this element
);
}
private void ApplyFilter(FilterContext context)
{
// Set the Query property of the context parameter to any IHqlQuery. In our case, we use a default query
// and narrow it down by joining with the ProductPartRecord.
context.Query = context.Query.Join(x => x.ContentPartRecord(typeof(ProductPartRecord)));
}
private LocalizedString DisplayFilter(FilterContext context)
{
return T("Content with ProductPart");
}
}
}