ConventionSet 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表一組用於建構模型的慣例。
public class ConventionSet
[System.Runtime.CompilerServices.Nullable(0)]
public class ConventionSet
type ConventionSet = class
[<System.Runtime.CompilerServices.Nullable(0)>]
type ConventionSet = class
Public Class ConventionSet
- 繼承
-
ConventionSet
- 屬性
備註
更多資訊與範例請參閱 模型建構慣例 。
建構函式
| 名稱 | Description |
|---|---|
| ConventionSet() |
代表一組用於建構模型的慣例。 |
屬性
方法
| 名稱 | Description |
|---|---|
| Add(IConvention) |
為集合加入慣例。 |
| AddAfter<TConvention>(IList<TConvention>, TConvention, Type) |
在現有約定之後再加一個約定。 |
| AddAfter<TConvention>(List<TConvention>, TConvention, Type) |
在現有約定之後再加一個約定。 |
| AddBefore<TConvention>(IList<TConvention>, TConvention, Type) |
在現有約定之前加入一個約定。 |
| AddBefore<TConvention>(List<TConvention>, TConvention, Type) |
在現有約定之前加入一個約定。 |
| CreateConventionSet(DbContext) |
呼叫此方法,當使用ModelBuilder外部OnModelCreating(ModelBuilder)時,僅為核心服務建置 。ConventionSet 請注意,使用此方法並不常見。 考慮用正常方式使用 DbContext 。 |
| Remove(Type) |
移除該類型的慣例。 |
| Remove<TConvention>(IList<TConvention>, Type) |
移除現有的慣例。 |
| Remove<TConvention>(List<TConvention>, Type) |
移除現有的慣例。 |
| Replace<TConvention,TImplementation>(IList<TConvention>, TImplementation) |
用衍生慣例取代現有慣例。 |
| Replace<TConvention,TImplementation>(List<TConvention>, TImplementation) |
用衍生慣例取代現有慣例。 |
| Replace<TImplementation>(TImplementation) |
用衍生慣例取代現有慣例。 同時註冊任何未被現有慣例實作的慣例類型。 |