本文整理汇总了C#中System.Property.ToPrettyString方法的典型用法代码示例。如果您正苦于以下问题:C# Property.ToPrettyString方法的具体用法?C# Property.ToPrettyString怎么用?C# Property.ToPrettyString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Property
的用法示例。
在下文中一共展示了Property.ToPrettyString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsDependentSidePropertyInAssociation
// detects whether the S-side Property represents the dependent side of an Association (e.g. for Split Entity or TPT or C-side Conditions)
private static bool IsDependentSidePropertyInAssociation(Property storageProperty)
{
if (storageProperty == null
|| storageProperty.EntityModel.IsCSDL)
{
Debug.Fail(
"should only receive a storage-side Property. Received property: "
+ (storageProperty == null ? "NULL" : storageProperty.ToPrettyString()));
return true; // returning true will mean this table's SGP settings will not be adjusted
}
foreach (var propRef in storageProperty.GetAntiDependenciesOfType<PropertyRef>())
{
var assoc = propRef.GetParentOfType(typeof(Association)) as Association;
if (assoc == null)
{
// no Association parent - so ignore this PropertyRef
continue;
}
foreach (var prop in assoc.DependentRoleProperties)
{
if (storageProperty.Equals(prop))
{
// found storage property on the dependent side which is part of an association
return true;
}
}
}
return false;
}
示例2: FindSSidePropInExistingArtifact
private Property FindSSidePropInExistingArtifact(Property sSidePropInTempArtifact)
{
if (null == sSidePropInTempArtifact)
{
Debug.Fail("Null sSidePropInTempArtifact");
return null;
}
var existingArtifactSet = _preExistingModel.Artifact.ArtifactSet;
if (null == existingArtifactSet)
{
Debug.Fail("Null ArtifactSet");
return null;
}
var sSidePropSymbolInTempArtifactSet = sSidePropInTempArtifact.NormalizedName;
var sSidePropInExistingArtifact = existingArtifactSet.LookupSymbol(sSidePropSymbolInTempArtifactSet) as Property;
if (null == sSidePropInTempArtifact)
{
Debug.Fail(
"Cannot find matching Property for sSidePropInTempArtifact " + sSidePropInTempArtifact.ToPrettyString()
+ " in existing artifact");
return null;
}
return sSidePropInExistingArtifact;
}
示例3: IsStorageForNonRootEntityType
// detects whether the S-side Property is within the table which provides storage for a C-side non-root EntityType (e.g. in a TPT hierarchy)
private static bool IsStorageForNonRootEntityType(Property storageProperty)
{
if (storageProperty == null
|| storageProperty.EntityModel.IsCSDL)
{
Debug.Fail(
"should only receive a storage-side Property. Received property: "
+ (storageProperty == null ? "NULL" : storageProperty.ToPrettyString()));
return true; // returning true will mean this table's SGP settings will not be adjusted
}
foreach (var sp in storageProperty.GetAntiDependenciesOfType<ScalarProperty>())
{
var etm = sp.GetParentOfType(typeof(EntityTypeMapping)) as EntityTypeMapping;
if (etm == null)
{
// no EntityTypeMapping parent - so don't count this mapping
continue;
}
var etmKind = etm.Kind;
if (EntityTypeMappingKind.Default != etmKind
&& EntityTypeMappingKind.IsTypeOf != etmKind)
{
// EntityTypeMapping is not for Default or IsTypeOf mapping - so don't count for finding the corresponding C-side EntityType
continue;
}
var cSideEntityType = etm.FirstBoundConceptualEntityType;
if (cSideEntityType != null
&& cSideEntityType.HasResolvableBaseType)
{
var inheritanceStrategy = ModelHelper.DetermineCurrentInheritanceStrategy(cSideEntityType);
if (InheritanceMappingStrategy.TablePerType == inheritanceStrategy)
{
// C-side EntityType has TPT inheritance strategy and is not the base-most type in its inheritance hierarchy
return true;
}
}
}
return false;
}
示例4: CreateNewConceptualPropertyAndMapping
/// <summary>
/// In the existing artifact create a new C-side Property
/// in the existing EntityType plus a mapping based on the
/// C-side and S-side Properties in the temp artifact
/// </summary>
private Property CreateNewConceptualPropertyAndMapping(
CommandProcessorContext cpc,
Property cSidePropInTempArtifact, Property sSidePropInTempArtifact,
EntityType existingEntityType)
{
Debug.Assert(cSidePropInTempArtifact != null, "Null C-side Property");
Debug.Assert(cSidePropInTempArtifact.EntityType.EntityModel.IsCSDL, "cSidePropInTempArtifact must be C-side");
Debug.Assert(sSidePropInTempArtifact != null, "Null S-side Property");
Debug.Assert(!sSidePropInTempArtifact.EntityType.EntityModel.IsCSDL, "sSidePropInTempArtifact must be S-side");
Debug.Assert(existingEntityType != null, "Null existing EntityType");
Debug.Assert(existingEntityType.EntityModel.IsCSDL, "Existing EntityType must be C-side");
var pcf = new PropertyClipboardFormat(cSidePropInTempArtifact);
Debug.Assert(
pcf != null, "Could not construct PropertyClipboardFormat for C-side Property " + cSidePropInTempArtifact.ToPrettyString());
if (null == pcf)
{
return null;
}
else
{
// store off matching S-side property in the existing
// artifact for mapping below
var sSidePropInExistingArtifact =
FindSSidePropInExistingArtifact(sSidePropInTempArtifact);
Debug.Assert(
null != sSidePropInExistingArtifact,
"Cannot find S-side Property matching the one in the temp artifact " + sSidePropInTempArtifact.ToPrettyString());
// create the C-side Property in the existing artifact
var cmd = new CopyPropertyCommand(pcf, existingEntityType);
CommandProcessor.InvokeSingleCommand(cpc, cmd);
var cSidePropInExistingArtifact = cmd.Property;
// now create the mapping for the C-side Property just created
if (null != cSidePropInExistingArtifact
&& null != sSidePropInExistingArtifact)
{
var cmd2 =
new CreateFragmentScalarPropertyCommand(
existingEntityType,
cSidePropInExistingArtifact, sSidePropInExistingArtifact);
CommandProcessor.InvokeSingleCommand(cpc, cmd2);
}
return cSidePropInExistingArtifact;
}
}