本文整理汇总了C#中MemberPath.IsScalarType方法的典型用法代码示例。如果您正苦于以下问题:C# MemberPath.IsScalarType方法的具体用法?C# MemberPath.IsScalarType怎么用?C# MemberPath.IsScalarType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberPath
的用法示例。
在下文中一共展示了MemberPath.IsScalarType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRequiredSlotsForCaseMember
/// <summary>
/// Returns an array of size <see cref="TotalSlots" /> which indicates the slots that are needed to constuct value at
/// <paramref
/// name="caseMemberPath" />
/// ,
/// e.g., CPerson may need pid and name (say slots 2 and 5 - then bools[2] and bools[5] will be true.
/// </summary>
/// <param name="caseMemberPath">
/// must be part of <see cref="m_caseStatements" />
/// </param>
private void GetRequiredSlotsForCaseMember(MemberPath caseMemberPath, bool[] requiredSlots)
{
Debug.Assert(m_caseStatements.ContainsKey(caseMemberPath), "Constructing case for regular field?");
Debug.Assert(requiredSlots.Length == TotalSlots, "Invalid array size for populating required slots");
var statement = m_caseStatements[caseMemberPath];
// Find the required slots from the when then clause conditions
// and values
var requireThisSlot = false;
foreach (var clause in statement.Clauses)
{
clause.Condition.GetRequiredSlots(m_projectedSlotMap, requiredSlots);
var slot = clause.Value;
if (!(slot is ConstantProjectedSlot))
{
// If this slot is a scalar and a non-constant,
// we need the lower down blocks to generate it for us
requireThisSlot = true;
}
}
var edmType = caseMemberPath.EdmType;
if (Helper.IsEntityType(edmType)
|| Helper.IsComplexType(edmType))
{
foreach (var instantiatedType in statement.InstantiatedTypes)
{
foreach (EdmMember childMember in Helper.GetAllStructuralMembers(instantiatedType))
{
var slotNum = GetSlotIndex(caseMemberPath, childMember);
requiredSlots[slotNum] = true;
}
}
}
else if (caseMemberPath.IsScalarType())
{
// A scalar does not need anything per se to be constructed
// unless it is referring to a field in the tree below, i.e., the THEN
// slot is not a constant slot
if (requireThisSlot)
{
var caseMemberSlotNum = m_projectedSlotMap.IndexOf(caseMemberPath);
requiredSlots[caseMemberSlotNum] = true;
}
}
else if (Helper.IsAssociationType(edmType))
{
// For an association, get the indices of the ends, e.g.,
// CProduct and CCategory in CProductCategory1
// Need just it's ends
var associationSet = (AssociationSet)caseMemberPath.Extent;
var associationType = associationSet.ElementType;
foreach (var endMember in associationType.AssociationEndMembers)
{
var slotNum = GetSlotIndex(caseMemberPath, endMember);
requiredSlots[slotNum] = true;
}
}
else
{
// For a reference, all we need are the keys
var refType = edmType as RefType;
Debug.Assert(refType != null, "What other non scalars do we have? Relation end must be a reference type");
var refElementType = refType.ElementType;
// Go through all the members of elementType and get the key properties
var entitySet = MetadataHelper.GetEntitySetAtEnd(
(AssociationSet)caseMemberPath.Extent,
(AssociationEndMember)caseMemberPath.LeafEdmMember);
foreach (var entityMember in refElementType.KeyMembers)
{
var slotNum = GetSlotIndex(caseMemberPath, entityMember);
requiredSlots[slotNum] = true;
}
}
}