本文整理匯總了C#中System.Data.Objects.DataClasses.IRelatedEnd接口的典型用法代碼示例。如果您正苦於以下問題:C# IRelatedEnd接口的具體用法?C# IRelatedEnd怎麽用?C# IRelatedEnd使用的例子?那麽, 這裏精選的接口代碼示例或許可以為您提供幫助。
IRelatedEnd接口屬於System.Data.Objects.DataClasses命名空間,在下文中一共展示了IRelatedEnd接口的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: using
//引入命名空間
using (AdventureWorksEntities context =
new AdventureWorksEntities())
{
Contact contact = new Contact();
// Create a new SalesOrderHeader.
SalesOrderHeader newSalesOrder1 = new SalesOrderHeader();
// Add SalesOrderHeader to the Contact.
contact.SalesOrderHeaders.Add(newSalesOrder1);
// Create another SalesOrderHeader.
SalesOrderHeader newSalesOrder2 = new SalesOrderHeader();
// Add SalesOrderHeader to the Contact.
contact.SalesOrderHeaders.Add(newSalesOrder2);
// Get all related ends
IEnumerable<IRelatedEnd> relEnds =
((IEntityWithRelationships)contact).RelationshipManager
.GetAllRelatedEnds();
foreach (IRelatedEnd relEnd in relEnds)
{
Console.WriteLine("Relationship Name: {0}", relEnd.RelationshipName);
Console.WriteLine("Source Role Name: {0}", relEnd.SourceRoleName);
Console.WriteLine("Target Role Name: {0}", relEnd.TargetRoleName);
}
}