Share via


MvcViewOptions.SuppressTempDataAttributePrefix Property

Definition

Gets or sets a value that determines if the ITempDataDictionary keys for properties annotated with TempDataAttribute include the prefix TempDataProperty-.

When Key is not specified, the lookup key for properties annotated with TempDataAttribute is derived from the property name. In releases prior to ASP.NET Core 2.1, the calculated key was the property name prefixed by the value TempDataProperty-. e.g. TempDataProperty-SuccessMessage. When this option is true, the calculated key for the property is the property name e.g. SuccessMessage.

Defaults to false.

public:
 property bool SuppressTempDataAttributePrefix { bool get(); void set(bool value); };
public bool SuppressTempDataAttributePrefix { get; set; }
member this.SuppressTempDataAttributePrefix : bool with get, set
Public Property SuppressTempDataAttributePrefix As Boolean

Property Value

Remarks

This property is associated with a compatibility switch and can provide a different behavior depending on the configured compatibility version for the application. See CompatibilityVersion for guidance and examples of setting the application's compatibility version.

Configuring the desired value of the compatibility switch by calling this property's setter will take precedence over the value implied by the application's CompatibilityVersion.

If the application's compatibility version is set to Version_2_0 then this setting will have the value false unless explicitly configured.

If the application's compatibility version is set to Version_2_1 or higher then this setting will have the value true unless explicitly configured.

Applies to