TableNameAttribute Constructor
Initializes a new instance of the TableNameAttribute class with the specified name for the table.
Namespace: System.Web.DynamicData
Assembly: System.Web.DynamicData (in System.Web.DynamicData.dll)
Parameters
- name
- Type: System.String
The name that the table will display.
The TableNameAttribute attribute is used to change the entity name in the metadata when there are entity name conflicts from multiple contexts. The TableNameAttribute attribute should not be used to change the display name. Instead, use the DisplayNameAttribute attribute to change the display name.
The following example shows how to set the table name. In the example, the displayed table name is changed from "ProductModelProductDescriptions" to "Prod Model Desc".
using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.DynamicData; [MetadataType(typeof(ProductModelProductDescriptionMetaData))] //[TableName(""Prod Model Desc")] [DisplayName("Prod Model Desc")] public partial class ProductModelProductDescription { } public class ProductModelProductDescriptionMetaData { [DisplayName("Modified")] [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)] public object ModifiedDate { get; set; } [DisplayName("Description")] public object ProductDescription { get; set; } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.