OwnedNavigationBuilder<TOwnerEntity,TDependentEntity>.OwnsOne 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
OwnsOne(String, String, Action<OwnedNavigationBuilder>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TOwnerEntity,TDependentEntity> OwnsOne(string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TDependentEntity> OwnsOne(string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'OwnerEntity, 'DependentEntity (requires 'OwnerEntity : null and 'DependentEntity : null)>
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)>
Public Overridable Function OwnsOne (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As OwnedNavigationBuilder(Of TOwnerEntity, TDependentEntity)
Public Overridable Function OwnsOne (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As OwnedNavigationBuilder(Of TEntity, TDependentEntity)
參數
- ownedTypeName
- String
此關係所針對的實體類型名稱。
- navigationName
- String
此實體類型中代表關係的參考導航屬性名稱。
- buildAction
- Action<OwnedNavigationBuilder>
一個執行關係配置的動作。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne(Type, String, Action<OwnedNavigationBuilder>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TOwnerEntity,TDependentEntity> OwnsOne(Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TDependentEntity> OwnsOne(Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'OwnerEntity, 'DependentEntity (requires 'OwnerEntity : null and 'DependentEntity : null)>
override this.OwnsOne : Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)>
Public Overridable Function OwnsOne (ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As OwnedNavigationBuilder(Of TOwnerEntity, TDependentEntity)
Public Overridable Function OwnsOne (ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As OwnedNavigationBuilder(Of TEntity, TDependentEntity)
參數
- ownedType
- Type
這個關係所針對的實體類型。
- navigationName
- String
此實體類型中代表關係的參考導航屬性名稱。
- buildAction
- Action<OwnedNavigationBuilder>
一個執行關係配置的動作。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne(String, Type, String, Action<OwnedNavigationBuilder>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TOwnerEntity,TDependentEntity> OwnsOne(string ownedTypeName, Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TDependentEntity> OwnsOne(string ownedTypeName, Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : string * Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'OwnerEntity, 'DependentEntity (requires 'OwnerEntity : null and 'DependentEntity : null)>
override this.OwnsOne : string * Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)>
Public Overridable Function OwnsOne (ownedTypeName As String, ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As OwnedNavigationBuilder(Of TOwnerEntity, TDependentEntity)
Public Overridable Function OwnsOne (ownedTypeName As String, ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As OwnedNavigationBuilder(Of TEntity, TDependentEntity)
參數
- ownedTypeName
- String
此關係所針對的實體類型名稱。
- ownedType
- Type
此關係所針對的實體類型的 CLR 類型。
- navigationName
- String
此實體類型中代表關係的參考導航屬性名稱。
- buildAction
- Action<OwnedNavigationBuilder>
一個執行關係配置的動作。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(String, String, Action<OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TOwnerEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'OwnerEntity, 'DependentEntity (requires 'OwnerEntity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TOwnerEntity, TDependentEntity)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TEntity, TDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- ownedTypeName
- String
此關係所針對的實體類型名稱。
- navigationName
- String
此實體類型中代表關係的參考導航屬性名稱。
- buildAction
- Action<OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>>
一個執行關係配置的動作。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(String, Expression<Func<TDependentEntity, TNewDependentEntity>>, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TOwnerEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
override this.OwnsOne : string * System.Linq.Expressions.Expression<Func<'DependentEntity, 'NewDependentEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'OwnerEntity, 'DependentEntity (requires 'OwnerEntity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
override this.OwnsOne : string * System.Linq.Expressions.Expression<Func<'DependentEntity, 'NewDependentEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TDependentEntity, TNewDependentEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TOwnerEntity, TDependentEntity)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TDependentEntity, TNewDependentEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TEntity, TDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- ownedTypeName
- String
此關係所針對的實體類型名稱。
- navigationExpression
- Expression<Func<TDependentEntity,TNewDependentEntity>>
一個 lambda 表達式,代表此實體型別的參考導航屬性,代表關係(customer => customer.Address)。
- buildAction
- Action<OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>>
一個執行關係配置的動作。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(String, String)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, string navigationName) where TNewDependentEntity : class;
override this.OwnsOne : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity (requires 'DependentEntity : null and 'NewDependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (ownedTypeName As String, navigationName As String) As OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- ownedTypeName
- String
此關係所針對的實體類型名稱。
- navigationName
- String
此實體類型中代表關係的參考導航屬性名稱。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(String, Expression<Func<TDependentEntity,TNewDependentEntity>>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity?>> navigationExpression) where TNewDependentEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity>> navigationExpression) where TNewDependentEntity : class;
override this.OwnsOne : string * System.Linq.Expressions.Expression<Func<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity (requires 'DependentEntity : null and 'NewDependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- ownedTypeName
- String
此關係所針對的實體類型名稱。
- navigationExpression
- Expression<Func<TDependentEntity,TNewDependentEntity>>
一個 lambda 表達式,代表此實體型別的參考導航屬性,代表關係(customer => customer.Address)。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(String, Action<OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TOwnerEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'OwnerEntity, 'DependentEntity (requires 'OwnerEntity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TOwnerEntity, TDependentEntity)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TEntity, TDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- navigationName
- String
此實體類型中代表關係的參考導航屬性名稱。
- buildAction
- Action<OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>>
一個執行關係配置的動作。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(String)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity> OwnsOne<TNewDependentEntity>(string navigationName) where TNewDependentEntity : class;
override this.OwnsOne : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity (requires 'DependentEntity : null and 'NewDependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (navigationName As String) As OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- navigationName
- String
此實體類型中代表關係的參考導航屬性名稱。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(Expression<Func<TDependentEntity,TNewDependentEntity>>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity> OwnsOne<TNewDependentEntity>(System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity?>> navigationExpression) where TNewDependentEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity> OwnsOne<TNewDependentEntity>(System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity>> navigationExpression) where TNewDependentEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity (requires 'DependentEntity : null and 'NewDependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (navigationExpression As Expression(Of Func(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- navigationExpression
- Expression<Func<TDependentEntity,TNewDependentEntity>>
一個 lambda 表達式,代表此實體型別的參考導航屬性,代表關係(customer => customer.Address)。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。
適用於
OwnsOne<TNewDependentEntity>(Expression<Func<TDependentEntity, TNewDependentEntity>>, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)
配置一個關係,使目標實體由該實體擁有(或其一部分)。 目標實體的鍵值總是從其所屬實體傳遞過來。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TOwnerEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TDependentEntity> OwnsOne<TNewDependentEntity>(System.Linq.Expressions.Expression<Func<TDependentEntity,TNewDependentEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>> buildAction) where TNewDependentEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'DependentEntity, 'NewDependentEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'OwnerEntity, 'DependentEntity (requires 'OwnerEntity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'DependentEntity, 'NewDependentEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'DependentEntity, 'NewDependentEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'NewDependentEntity : null)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (navigationExpression As Expression(Of Func(Of TDependentEntity, TNewDependentEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TOwnerEntity, TDependentEntity)
Public Overridable Function OwnsOne(Of TNewDependentEntity As Class) (navigationExpression As Expression(Of Func(Of TDependentEntity, TNewDependentEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TDependentEntity, TNewDependentEntity))) As OwnedNavigationBuilder(Of TEntity, TDependentEntity)
類型參數
- TNewDependentEntity
這個關係所針對的實體類型。
參數
- navigationExpression
- Expression<Func<TDependentEntity,TNewDependentEntity>>
一個 lambda 表達式,代表此實體型別的參考導航屬性,代表關係(customer => customer.Address)。
- buildAction
- Action<OwnedNavigationBuilder<TDependentEntity,TNewDependentEntity>>
一個執行關係配置的動作。
傳回
一個可以用來設定實體類型的物件。
備註
即使導覽屬於同一類型,每個所有權關係的目標實體類型仍被視為不同的實體類型。 目標實體類型的設定不會套用到其他所有權關係的目標實體類型。
大多數對擁有實體的操作都需要透過擁有者實體使用相應的導航系統存取。
呼叫此方法後,你應該串接一個呼叫以 WithOwner 完整配置關係。