共用方式為


ScaffoldColumnAttribute 類別

定義

指定類別或數據行是否使用 Scaffolding。

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

範例

以下程式碼範例透過將支架屬性套用到 Products 部分類別中的 ProductID 物件並設為 true,暴露 AdventureWorksLT 資料庫中 Products 資料表的 ProductID 欄位。 它透過套用 ThumbnailPhotoFileName 物件的支架屬性並將其設為 false

[MetadataType(typeof(ProductMetadata))]
public partial class Product
{

}

public class ProductMetadata
{
    [ScaffoldColumn(true)]
    public object ProductID;

    [ScaffoldColumn(false)]
    public object ThumbnailPhotoFileName;

}
<MetadataType(GetType(ProductMetadata))>
Public Partial Class Product

End Class

Public Class ProductMetadata
    <ScaffoldColumn(True)>
    Public ProductID As Object

    <ScaffoldColumn(False)>
    Public ThumbnailPhotoFileName As Object

End Class

要編譯範例程式碼,你需要以下條件:

  • 任何版本的 Visual Studio 2010 或更新版本。

  • AdventureWorksLT 範例資料庫。 欲了解如何下載與安裝 SQL Server 範例資料庫,請參閱 GitHub 上的 Microsoft SQL Server 產品範例:資料庫 。 確保你安裝的是你所執行的 SQL Server 版本的正確範例資料庫。

  • 一個動態資料網站。 這讓你能為資料庫和包含可自訂資料欄位及覆蓋方法的類別建立資料上下文。 此外,它還創造了使用前述頁面的環境。 欲了解更多資訊,請參閱 《攻略:利用支架建立新的動態資料網站》。

備註

支架是基於資料庫結構產生網頁範本的機制。 ASP.NET Dynamic Data 利用鷹架技術生成基於網頁的使用者介面,讓使用者能夠瀏覽並更新資料庫。 此類別利用該 Scaffold 特性來啟用動態資料網站的支架。

鷹架化透過動態顯示頁面 ASP.NET 資料模型,無需實體頁面,強化了頁面架構。

鷹架提供以下功能:

  • 用最少或不寫程式碼來建立一個以資料為驅動的網頁應用程式。

  • 開發時間很快。

  • 這些頁面功能齊全,包含顯示、插入、編輯、刪除、排序及分頁功能。

  • 內建基於資料庫架構的資料驗證功能。

  • 為每個外鍵或布林欄位建立的過濾器。

此類別可用於啟用或停用資料模型中資料欄位的支架,方法是將此屬性套用到代表該資料表的類別中適當的資料欄位物件。

建構函式

名稱 Description
ScaffoldColumnAttribute(Boolean)

初始化使用該Scaffold屬性的新實例ScaffoldColumnAttribute

屬性

名稱 Description
Scaffold

取得或設定指定是否啟用鷹架的值。

TypeId

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

(繼承來源 Attribute)

方法

名稱 Description
Equals(Object)

傳回值,這個值表示這個實例是否等於指定的物件。

(繼承來源 Attribute)
GetHashCode()

傳回這個實例的哈希碼。

(繼承來源 Attribute)
GetType()

取得目前實例的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,指出這個實例的值是否為衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,傳回值,指出這個實例是否等於指定的物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

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

(繼承來源 Object)

明確介面實作

名稱 Description
_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)

適用於