thomas
thomas

Reputation: 11

ASP.Net Dynamic Data IS showing my primary keys for every table when using Entities

Using a very run-of-the-mill database, with identity int for primary keys, a Dynamic Data Entities Project (EntityFramework) displays the primary key for view and edit. When using Linq to Sql, the primary key fields are not displayed.

I would like to hide the primary keys and use Entity Framework (VS 2008, .Net 3.5 sp1). thanks

Upvotes: 1

Views: 1092

Answers (1)

Craig Stuntz
Craig Stuntz

Reputation: 126587

Use ScaffoldColumnAttribute to not scaffold a column.

You'll need to either customize code generation (easier in EF 4) or use a buddy class for this.

[MetadataType(typeof(MyEntity_Metadata))]
public partial class MyEntity 
{
}

public class MyEntity_Metadata 
{
    [ScaffoldColumn(false)]
    public int Id { get; set; }
}

Upvotes: 2

Related Questions