本文整理汇总了C#中IEdmEntitySet.FindNavigationTarget方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmEntitySet.FindNavigationTarget方法的具体用法?C# IEdmEntitySet.FindNavigationTarget怎么用?C# IEdmEntitySet.FindNavigationTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmEntitySet
的用法示例。
在下文中一共展示了IEdmEntitySet.FindNavigationTarget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInitialize
public void TestInitialize()
{
this.testModel = Test.OData.Utils.Metadata.TestModels.BuildTestModel();
this.defaultContainer = this.testModel.EntityContainer;
this.personSet = this.defaultContainer.FindEntitySet("Persons");
this.personType = (IEdmEntityType)this.testModel.FindType("TestModel.Person");
this.employeeType = (IEdmEntityType)this.testModel.FindType("TestModel.Employee");
this.officeType = (IEdmEntityType)this.testModel.FindType("TestModel.OfficeType");
this.addressType = (IEdmComplexType)this.testModel.FindType("TestModel.Address");
this.metropolitanCitySet = this.defaultContainer.FindEntitySet("MetropolitanCities");
this.metropolitanCityType = (IEdmEntityType)this.testModel.FindType("TestModel.MetropolitanCityType");
this.boss = this.defaultContainer.FindSingleton("Boss");
this.containedOfficeNavigationProperty = (IEdmNavigationProperty)this.metropolitanCityType.FindProperty("ContainedOffice");
this.containedOfficeSet = (IEdmContainedEntitySet)metropolitanCitySet.FindNavigationTarget(this.containedOfficeNavigationProperty);
this.containedMetropolitanCityNavigationProperty = (IEdmNavigationProperty)this.officeType.FindProperty("ContainedCity");
this.containedMetropolitanCitySet = (IEdmContainedEntitySet)containedOfficeSet.FindNavigationTarget(this.containedMetropolitanCityNavigationProperty);
}
示例2: GetEntitySet
/// <summary>
/// Gets the entity set for this segment.
/// </summary>
/// <param name="previousEntitySet">The entity set of the previous path segment.</param>
/// <returns>
/// The entity set for this segment.
/// </returns>
public override IEdmEntitySet GetEntitySet(IEdmEntitySet previousEntitySet)
{
if (NavigationProperty != null && previousEntitySet != null)
{
// Cast will fail in singleton / containment cases.
return previousEntitySet.FindNavigationTarget(NavigationProperty) as IEdmEntitySet;
}
return null;
}
示例3: GetTargetEntitySet
/// <summary>
/// Gets the target entity set for the given function import.
/// </summary>
/// <param name="functionImport">The function import.</param>
/// <param name="sourceEntitySet">The source entity set.</param>
/// <param name="model">The model.</param>
/// <returns>The target entity set of the function import or null if it could not be determined.</returns>
internal static IEdmEntitySet GetTargetEntitySet(this IEdmFunctionImport functionImport, IEdmEntitySet sourceEntitySet, IEdmModel model)
{
DebugUtils.CheckNoExternalCallers();
IEdmEntitySet targetEntitySet;
if (functionImport.TryGetStaticEntitySet(out targetEntitySet))
{
return targetEntitySet;
}
if (sourceEntitySet == null)
{
return null;
}
if (functionImport.IsBindable && functionImport.Parameters.Any())
{
IEdmFunctionParameter parameter;
IEnumerable<IEdmNavigationProperty> path;
if (functionImport.TryGetRelativeEntitySetPath(model, out parameter, out path))
{
// TODO: throw better exception
WebUtil.CheckSyntaxValid(parameter == functionImport.Parameters.First());
targetEntitySet = sourceEntitySet;
foreach (var navigation in path)
{
targetEntitySet = targetEntitySet.FindNavigationTarget(navigation);
if (targetEntitySet == null)
{
return null;
}
}
return targetEntitySet;
}
}
return null;
}
示例4: GetEntitySet
/// <summary>
/// Gets the entity set for this segment.
/// </summary>
/// <param name="previousEntitySet">The entity set of the previous path segment.</param>
/// <returns>
/// The entity set for this segment.
/// </returns>
public override IEdmEntitySet GetEntitySet(IEdmEntitySet previousEntitySet)
{
if (NavigationProperty != null && previousEntitySet != null)
{
return previousEntitySet.FindNavigationTarget(NavigationProperty);
}
return null;
}
示例5: FindNavigationTarget
/// <summary>
/// Finds the navigation target of this navigation property given a server entity set.
/// </summary>
/// <param name="sourceServerEntitySet">The source server entity set.</param>
/// <returns>The navigation target or null if one couldn't be found.</returns>
internal EdmEntitySetFacade FindNavigationTarget(IEdmEntitySet sourceServerEntitySet)
{
Debug.Assert(sourceServerEntitySet != null, "sourceServerEntitySet != null");
// if no property could be found, then there is no way to get the target.
if (this.serverProperty == null)
{
return null;
}
// find the target using the server property.
IEdmEntitySet serverTarget = sourceServerEntitySet.FindNavigationTarget(this.serverProperty);
if (serverTarget == null)
{
return null;
}
// if a target was found, wrap it in a new facade and return it.
return this.modelFacade.GetOrCreateEntityContainerFacade(serverTarget.Container).GetOrCreateEntitySetFacade(serverTarget);
}
示例6: IsAssociationSetRegistered
public bool IsAssociationSetRegistered(IEdmEntitySet entitySet, IEdmNavigationProperty navigation)
{
return this.registeredAssociationSets.Any(s => s.Key == entitySet && s.Value == navigation) ||
this.registeredAssociationSets.Any(s => s.Key == entitySet.FindNavigationTarget(navigation) && s.Value == navigation.Partner);
}