You are using a a component with two dates as a custom meta field You are using the CustomMetaDateRangeCriteria to filter data with one date field (for example: Date) The same query is working fine in 2011 environment. After profiling the query produced using SQL Profile you see that custommeta_.KEY_NAME is not generated See code sample below: Query query = new Query(); var crteria = new List<Criteria>(); crteria.Add(new PublicationCriteria(23)); crteria.Add(new ItemSchemaCriteria(2525)); ItemTypeCriteria isComponent = new ItemTypeCriteria(16); crteria.Add(isComponent); CustomMetaDateRangeCriteria criteriaYear = new CustomMetaDateRangeCriteria("date", "2013-01-01 00:00:00.000", "2013-12-31 00:00:00.000", true); crteria.Add(criteriaYear); query.Criteria = CriteriaFactory.And(crteria.ToArray()); query.SetResultFilter(new LimitFilter(100)); query.AddSorting(new SortParameter(new CustomMetaKeyColumn("date", MetadataType.DATE), SortParameter.Descending)); var result = query.ExecuteQuery(); Generates the following query: declare @p1 int --set @p1=4 exec sp_prepexec @p1 output, N'@P0 int, @P1 int, @P2 int, @P3 nvarchar(4000), @P4 datetime2, @P5 nvarchar(4000), @P6 datetime2', N'select distinct top 100 itemmeta0_.PUBLICATION_ID as col_0_0_, itemmeta0_.ITEM_REFERENCE_ID as col_1_0_, itemmeta0_.ITEM_TYPE as col_2_0_, itemmeta0_.ITEM_REFERENCE_ID as col_3_0_ from ITEMS itemmeta0_ cross join CUSTOM_META custommeta1_ cross join COMPONENT componentm2_ inner join ITEMS componentm2_1_ on componentm2_.PUBLICATION_ID=componentm2_1_.PUBLICATION_ID and componentm2_.ITEM_REFERENCE_ID=componentm2_1_.ITEM_REFERENCE_ID where itemmeta0_.PUBLICATION_ID=@P0 and itemmeta0_.ITEM_REFERENCE_ID=componentm2_.ITEM_REFERENCE_ID and itemmeta0_.PUBLICATION_ID=componentm2_.PUBLICATION_ID and componentm2_.SCHEMA_ID=@P1 and itemmeta0_.ITEM_TYPE=@P2 and itemmeta0_.PUBLICATION_ID=custommeta1_.PUBLICATION_ID and itemmeta0_.ITEM_REFERENCE_ID=custommeta1_.ITEM_ID and itemmeta0_.ITEM_TYPE=custommeta1_.ITEM_TYPE and custommeta1_.KEY_NAME=@P3 and custommeta1_.KEY_DATE_VALUE>=@P4 and itemmeta0_.PUBLICATION_ID=custommeta1_.PUBLICATION_ID and itemmeta0_.ITEM_REFERENCE_ID=custommeta1_.ITEM_ID and itemmeta0_.ITEM_TYPE=custommeta1_.ITEM_TYPE and custommeta1_.KEY_NAME=@P5 and custommeta1_.KEY_DATE_VALUE<=@P6 order by itemmeta0_.ITEM_REFERENCE_ID ASC', 23, 2525, 16, N'date', '2013-01-01 00:00:00', N'date', '2013-12-31 23:59:59' select @p1 |
Apply hotfix CD_8.1.1.5747.zip |
- CIL.NET incorrectly serializes CustomMetaDateRangeCriteria. |