譯 第45節 EF6 索引屬性

2022-01-11 05:29:44 字數 494 閱讀 3953

原文:

entity framework 6提供了index屬性來建立資料庫中特定列的index,如下所示:

class

student

public

int student_id

public

string studentname

[index]

public

int registrationnumber

}

預設情況下,索引名稱將為ix_ 。 當然你也可以更改索引名稱。

可以通過指定isclustered = true和唯一索引來指定isunique = true來使其成為聚簇索引。

[index( "

index_regnum

", isclustered=true, isunique=true

)]public

int registrationnumber

譯 第44節 EF6 儲存過程對映

ef6 code first提供了建立和使用儲存過程以新增,更新和刪除操作的功能。這在以前的entity framework版本中是沒有的。student實體 class student public int student id public string studentname 以下示例使用fl...

譯 第39節 EF6 資料庫命令日誌

原文 本節,我們學習如何記錄entity framework傳送到資料庫的命令和查詢。在ef 6之前,我們使用資料庫跟蹤工具或第三方跟蹤實用程式跟蹤由entity framework傳送的資料庫查詢和命令。現在,ef 6提供了乙個簡單的機制來記錄entity framework所做的一切。它使用co...

譯 第7節 對映繼承策略

原文 我們在之前的部分看到,ef為每個具體的領域類建立資料庫表。然而,你可以使用繼承來設計域類。物件導向技術包括 has a 和 is a 關係,而基於sql的關係模型在表之間只有乙個 has a 關係。sql資料庫管理系統不支援型別繼承。那麼,將如何使用關聯式資料庫對映物件導向的領域類?以下是在c...