ScaffoldTableAttribute 類別

定義

指定類別或資料的資料表 (Data Table) 是否使用 Scaffolding。

public ref class ScaffoldTableAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)]
public class ScaffoldTableAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)>]
type ScaffoldTableAttribute = class
    inherit Attribute
Public Class ScaffoldTableAttribute
Inherits Attribute
繼承
ScaffoldTableAttribute
屬性

範例

下列程式代碼範例會將 Scaffold 屬性套用至代表 ErrorLog 數據表的 ErrorLog 部分類別,以隱藏 AdventureWorksLT 資料庫中的 ErrorLog 數據表。 Scaffold 屬性會設定為 false

[MetadataType (typeof(ErrorLogMetadata))]  
[ScaffoldTable(false)]  
public partial class ErrorLog  
{  

}  

public class ErrorLogMetadata  
{  

}  
<MetadataType(GetType(ErrorLogMetadata))> _   
<ScaffoldTable(False)>   
Public Partial Class ErrorLog   

End Class   

Public Class ErrorLogMetadata  

End Class   

若要編譯這段範例程式碼,您需要下列項目:

  • Visual Studio 2008 Service Pack 1 或 Visual Developer 2008 Express Edition Service Pack 1。

  • AdventureWorksLT 範例資料庫。 如需如何下載及安裝 SQL Server 範例資料庫的詳細資訊,請參閱 Microsoft SQL Server 產品範例:GitHub 上的資料庫。 請確定您為執行中之 SQL Server 版本安裝正確的範例資料庫版本。

  • 動態數據網站。 這可讓您建立資料庫的數據內容,以及包含要自定義之數據欄位的 類別,以及要覆寫的方法。 此外,它會建立環境,以使用先前所述的頁面。 如需詳細資訊,請參閱逐步解說 :使用 Scaffolding 建立新的動態數據網站

備註

Scaffolding 是根據資料庫架構產生網頁範本的機制。 ASP.NET 動態數據會使用 Scaffolding 來產生 Web 型 UI,讓使用者能夠檢視和更新資料庫。 這個類別會 Scaffold 使用 屬性來啟用動態數據網站中個別數據表的 Scaffolding。 Scaffolding 會根據不需要實體頁面的數據模型動態顯示頁面,藉此增強 ASP.NET 頁面架構。

Scaffolding 提供下列專案:

  • 建立數據驅動 Web 應用程式的最少或無程式代碼。

  • 快速開發時間。

  • 功能完整的頁面,包括顯示、插入、編輯、刪除、排序和分頁功能。

  • 以資料庫架構為基礎的內建數據驗證。

  • 針對每個外鍵或布爾值欄位所建立的篩選。

這個類別可用來在數據模型中啟用或停用數據表的 Scaffolding,方法是將此屬性套用至代表數據表的部分類別。

建構函式

ScaffoldTableAttribute(Boolean)

使用 ScaffoldTableAttribute 屬性,初始化 Scaffold 的新執行個體。

屬性

Scaffold

取得或設定值,這個值指定是否啟用 Scaffolding。

TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。

(繼承來源 Attribute)

方法

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

(繼承來源 Attribute)
GetHashCode()

傳回這個執行個體的雜湊碼。

(繼承來源 Attribute)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。

(繼承來源 Attribute)

適用於

另請參閱