To implement it, you must have the following members in the LocationsDataProvider class:
public override IEnumerable GetItemsByTaxon(Guid taxonId, bool isSingleTaxon,
string propertyName, Type itemType, string filterExpression, string orderExpression,
int skip, int take, ref int? totalCount)
{
if (itemType == typeof(LocationItemUrlData))
{
this.CurrentTaxonomyProperty = propertyName;
var query = (IQueryable<LocationItem>)GetItems(itemType, filterExpression, string.Empty, skip, take, ref totalCount);
if (isSingleTaxon)
{
var query0 = from i in query
where (Guid)i.GetValue(this.CurrentTaxonomyProperty) == taxonId
select i;
if (!string.IsNullOrEmpty(orderExpression))
return query0.OrderBy(orderExpression);
return query0;
}
else
{
var query1 = from i in query
where ((IList)i.GetValue(this.CurrentTaxonomyProperty)).Contains(taxonId)
select i;
if (!string.IsNullOrEmpty(orderExpression))
return query1.OrderBy(orderExpression);
return query1;
}
}
throw GetInvalidItemTypeException(itemType, this.GetKnownTypes());
}
public override IDataItem GetItemFromUrl(Type itemType, string url, bool published, out string redirectUrl)
{
if (itemType == null)
throw new ArgumentNullException("itemType");
if (String.IsNullOrEmpty(url))
throw new ArgumentNullException("Url");
var urlType = this.GetUrlTypeFor(itemType);
var urlData = this.GetUrls(urlType).Where(u => u.Url == url).FirstOrDefault();
if (urlData != null)
{
var item = urlData.Parent;
if (urlData.RedirectToDefault)
redirectUrl = this.GetItemUrl((ILocatable)item, CultureInfo.GetCultureInfo(urlData.Culture));
else
redirectUrl = null;
if (item != null)
item.Provider = this;
return item;
}
redirectUrl = null;
return null;
}
public override Type GetParentTypeFor(Type contentType)
{
return null;
}
public override Type GetUrlTypeFor(Type itemType)
{
if (itemType == typeof(LocationItem))
{
return typeof(LocationItemUrlData);
}
throw GetInvalidItemTypeException(itemType, this.GetKnownTypes());
}
public override Type[] GetKnownTypes()
{
return new[] { typeof(LocationItem) };
}
public override string RootKey
{
get
{
return "LocaitionsDataProvider";
}
}