• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API
v16
Search Results for

    Show / Hide Table of Contents

    Class AttributeRename

    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.

    TODO: update the standard list with attribute rename and the StreamSwitch one I made last week

    The AttributeRename DataSource is part of the Standard EAV Data Sources. It renames attributes from items so that the result has more appropriate field/property names. Optionally it will also remove all fields which have not been renamed, in case you only want the smaller, renamed items.

    How to use with the VisualQuery

    When using the VisualQuery you can just drag it into your query. Now you can configure what properties you want and not.

    In this screenshot you can see:

    1. The DataSource which we're configuring
    2. The field map renaming fields
    3. Toggle to keep attributes which were not renamed - default is True
    4. The optional type name which you can give the modified entities - default is blank, resulting in the original type being used

    Programming With The AttributeRename 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.

    Read also

    • DataSource / DataStream
    • List of all EAV Data Sources
    • Query / VisualQuery

    Demo App and further links

    You should find some examples in this demo App

    • Demo App with examples for most DataSources

    History

    1. Introduced in EAV / 2sxc 10.27

    API Documentation

    Inheritance
    object
    ServiceBase
    ServiceBase<DataSourceBase.MyServices>
    DataSourceBase
    AttributeRename
    Implements
    IDataSource
    IAppIdentity
    IZoneIdentity
    IAppIdentityLight
    ICacheKey
    ICacheExpiring
    ITimestamped
    IHasLog
    IDataSourceLinkable
    Inherited Members
    DataSourceBase.Immutable
    DataSourceBase.AppId
    DataSourceBase.ZoneId
    DataSourceBase.Guid
    DataSourceBase.Error
    DataSourceBase.CacheTimestamp
    DataSourceBase.CacheChanged(long)
    DataSourceBase.Configuration
    DataSourceBase.Link
    DataSourceBase.In
    DataSourceBase.TryGetIn(string)
    DataSourceBase.TryGetOut(string)
    DataSourceBase.Out
    DataSourceBase.this[string]
    DataSourceBase.GetStream(string, string, bool, bool)
    DataSourceBase.List
    DataSourceBase.Attach(IDataSource)
    DataSourceBase.Attach(string, IDataSource, string)
    DataSourceBase.Attach(string, IDataStream)
    DataSourceBase.ProvideOut(Func<IEnumerable<IEntity>>, string)
    DataSourceBase.ProvideOut(Func<IImmutableList<IEntity>>, string)
    Namespace: ToSic.Eav.DataSources
    Assembly: ToSic.Eav.DataSources.dll
    Syntax
    [PublicApi_Stable_ForUseInYourCode]
    [VisualQuery(NiceName = "Rename Attribute/Property", UiHint = "Rename some attributes / properties", Icon = "edit_attributes", Type = DataSourceType.Modify, NameId = "ToSic.Eav.DataSources.AttributeRename, ToSic.Eav.DataSources", DynamicOut = false, In = new string[] { "Default*" }, ConfigurationType = "c5918cb8-d35a-48c7-9380-a437edde66d2", HelpLink = "https://go.2sxc.org/DsAttributeRename")]
    public class AttributeRename : DataSourceBase, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog, IDataSourceLinkable
    Remarks

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

    Properties

    | Improve this Doc View Source

    AttributeMap

    A string containing one or more attribute maps. The syntax is "NewName=OldName" - one mapping per line

    Declaration
    [Configuration]
    public string AttributeMap { get; set; }
    Property Value
    Type Description
    string
    | Improve this Doc View Source

    KeepOtherAttributes

    True/false if attributes not renamed should be preserved.

    Declaration
    [Configuration(Fallback = true)]
    public bool KeepOtherAttributes { get; set; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    TypeName

    A string containing one or more attribute maps. The syntax is "NewName=OldName" - one mapping per line

    Declaration
    [Configuration]
    public string TypeName { get; set; }
    Property Value
    Type Description
    string

    Implements

    IDataSource
    IAppIdentity
    IZoneIdentity
    IAppIdentityLight
    ICacheKey
    ICacheExpiring
    ITimestamped
    IHasLog
    IDataSourceLinkable
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX