Remove autogeneration GUID column from adding input pages in dynamic data web application

I have a dynamic data web application that uses a database with GUIDs as the primary keys for tables. All GUID fields have a default value set to NEWID (), so SQL Server will generate a new GUID for any record. However, on my website with dynamic data, a GUID field appears in the insertion of new input pages, and the user is expected to enter data. How can I prevent the display of a field?

+3
source share
2 answers

According to MSDN :

"You can hide the primary key, like any other column, using the Scaffold attribute and setting its value to false. Since the automatically generated keys are not recognized, insert page templates do not work with EDM by default for tables that have automatic primary keys, unless you create a partial class for the object and apply the Scaffold attribute with the value false. "

In addition, as a third-party option, it is preferable to use "newsequentialid ()" for the default Guid if you are using SQL Server 2005 or higher, since it is more efficient to insert.

+3
source

Incorrect answer..

, , 1 , GUID . , - - guid (, , ).

, emdx

StoreGeneratedPattern="Identity"

Guid " SSDL". :

   <Property Name="Guid" Type="uniqueidentifier" Nullable="false" StoreGeneratedPattern="Identity"/>

yhou , "CSDL content", .

Entity Framework 4.0 Visual studio 10 .NET framework 4.0

+3

All Articles