forked from dotnet/dotnet-api-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScaffoldTableAttribute.xml
157 lines (129 loc) · 8.59 KB
/
ScaffoldTableAttribute.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<Type Name="ScaffoldTableAttribute" FullName="System.ComponentModel.DataAnnotations.ScaffoldTableAttribute">
<TypeSignature Language="C#" Value="public class ScaffoldTableAttribute : Attribute" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ScaffoldTableAttribute extends System.Attribute" />
<TypeSignature Language="DocId" Value="T:System.ComponentModel.DataAnnotations.ScaffoldTableAttribute" />
<TypeSignature Language="VB.NET" Value="Public Class ScaffoldTableAttribute
Inherits Attribute" />
<TypeSignature Language="F#" Value="type ScaffoldTableAttribute = class
 inherit Attribute" />
<TypeSignature Language="C++ CLI" Value="public ref class ScaffoldTableAttribute : Attribute" />
<AssemblyInfo>
<AssemblyName>System.ComponentModel.DataAnnotations</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Specifies whether a class or data table uses scaffolding.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Scaffolding is the mechanism for generating web page templates based on database schemas. ASP.NET Dynamic Data uses scaffolding to generate Web-based UI that lets a user to view and update a database. This class uses the <xref:System.ComponentModel.DataAnnotations.ScaffoldTableAttribute.Scaffold%2A> property to enable scaffolding of individual tables in a Dynamic Data Web Site. Scaffolding enhances the ASP.NET page framework by dynamically displaying pages based on the data model with no physical pages required.
Scaffolding provides the following:
- Minimal or no code to create a data-driven Web application.
- Quick development time.
- Pages that are fully functional, including display, insert, edit, delete, sorting, and paging functionalities.
- Built-in data validation based on the database schema.
- Filters that are created for each foreign key or Boolean fields.
This class can be used to enable or disable scaffolding of data tables in a data model by applying this attribute to the partial class that represents the table.
## Examples
The following code example hides the ErrorLog Table in AdventureWorksLT database by applying the scaffold attribute to the ErrorLog partial class that represents the ErrorLog table. The scaffold property is set to `false`.
```csharp
[MetadataType (typeof(ErrorLogMetadata))]
[ScaffoldTable(false)]
public partial class ErrorLog
{
}
public class ErrorLogMetadata
{
}
```
```vb
<MetadataType(GetType(ErrorLogMetadata))> _
<ScaffoldTable(False)>
Public Partial Class ErrorLog
End Class
Public Class ErrorLogMetadata
End Class
```
To compile the example code, you need the following:
- Visual Studio 2008 Service Pack 1 or Visual Developer 2008 Express Edition Service Pack 1.
- The AdventureWorksLT sample database. For information about how to download and install the SQL Server sample database, see [Microsoft SQL Server Product Samples: Database](https://github.com/Microsoft/sql-server-samples/releases) on GitHub. Make sure that you install the correct version of the sample database for the version of SQL Server that you are running.
- A Dynamic Data Web site. This enables you to create a data context for the database and the class that contains the data field to customize and the methods to override. In addition, it creates the environment in which to use the page described before. For more information, see [Walkthrough: Creating a New Dynamic Data Web Site Using Scaffolding](/previous-versions/aspnet/cc488469(v=vs.100)).
]]></format>
</remarks>
<related type="Article" href="/previous-versions/ee377606(v=vs.140)">ASP.NET Dynamic Data Scaffolding</related>
<related type="Article" href="/previous-versions/aspnet/cc488469(v=vs.100)">Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ScaffoldTableAttribute (bool scaffold);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(bool scaffold) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ComponentModel.DataAnnotations.ScaffoldTableAttribute.#ctor(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (scaffold As Boolean)" />
<MemberSignature Language="F#" Value="new System.ComponentModel.DataAnnotations.ScaffoldTableAttribute : bool -> System.ComponentModel.DataAnnotations.ScaffoldTableAttribute" Usage="new System.ComponentModel.DataAnnotations.ScaffoldTableAttribute scaffold" />
<MemberSignature Language="C++ CLI" Value="public:
 ScaffoldTableAttribute(bool scaffold);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.DataAnnotations</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="scaffold" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="scaffold">The value that specifies whether scaffolding is enabled.</param>
<summary>Initializes a new instance of <see cref="T:System.ComponentModel.DataAnnotations.ScaffoldTableAttribute" /> using the <see cref="P:System.ComponentModel.DataAnnotations.ScaffoldTableAttribute.Scaffold" /> property.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can set `scaffold` to `true` for the entire data model to expose all data tables in the database for CRUD (Create, Read, Update and Delete) operations or expose individual tables to CRUD operations by setting `scaffold` for individual tables to `true`.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Scaffold">
<MemberSignature Language="C#" Value="public bool Scaffold { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool Scaffold" />
<MemberSignature Language="DocId" Value="P:System.ComponentModel.DataAnnotations.ScaffoldTableAttribute.Scaffold" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Scaffold As Boolean" />
<MemberSignature Language="F#" Value="member this.Scaffold : bool" Usage="System.ComponentModel.DataAnnotations.ScaffoldTableAttribute.Scaffold" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool Scaffold { bool get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.DataAnnotations</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the value that specifies whether scaffolding is enabled.</summary>
<value>
<see langword="true" /> if scaffolding is enabled; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Scaffolding is the mechanism of generating web page templates based on database schemas. ASP.NET Dynamic Data uses scaffolding to generate Web-based UI that lets a user to view and update a database. For more information about the Scaffold attribute, see <xref:System.ComponentModel.DataAnnotations.ScaffoldTableAttribute>.
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>