Table of Contents

Class EntityTypeFilter

Namespace
ToSic.Eav.DataSources
Assembly
ToSic.Eav.DataSources.dll

The base class for all DataSources, especially custom DataSources. It must always be inherited. It provides a lot of core functionality to get configurations, ensure caching and more.

Important: in most cases you will inherit the CustomDataSource DataSource for custom data sources.

Data Source: ContentType EntityType Filter

Note

this data source used to be called EntityTypeFilter, we renamed it in 2sxc 9.8 for consistency

The ContentTypeFilter DataSource is part of the Standard EAV Data Sources. It will only let items pass through, which are of a specific type.

How to use with the VisualQuery

When using the VisualQuery you can just drag it into your query. In the settings you'll specify the type-name. The resulting query will usually be a bit like this:

The above example shows:

  1. a two content-type filters, each filtering a different type

Programming With The ContentTypeFilter DataSource

We recommend to use the VisualQuery where possible, as it's easier to understand and is identical for C# and JavaScript. It's also better because it separates data-retrieval from visualization.

// A source which can filter by Content-Type (EntityType)
var allAuthors = CreateSource<EntityTypeFilter>();
allAuthors.TypeName = "Author";

Read also

You should find some examples in this demo App

History

  1. Introduced in EAV 3.x, 2sxc ?

API Documentation

[PublicApi]
[VisualQuery(NiceName = "Type-Filter", UiHint = "Only keep items of the specified type", Icon = "alt_route", Type = DataSourceType.Filter, NameId = "ToSic.Eav.DataSources.EntityTypeFilter, ToSic.Eav.DataSources", DynamicOut = false, In = new string[] { "Default*" }, ConfigurationType = "|Config ToSic.Eav.DataSources.EntityTypeFilter", HelpLink = "https://go.2sxc.org/DsTypeFilter")]
public class EntityTypeFilter : DataSourceBase, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog, IDataSourceLinkable
Inheritance
EntityTypeFilter
Implements
Inherited Members

Remarks

Had a major, breaking update in v15. Consult the guide to upgrade your custom data sources.

Properties

TypeName

The name of the type to filter for. Either the normal name or the 'StaticName' which is usually a GUID.

[Configuration]
public string TypeName { get; set; }

Property Value

string