本文整理汇总了C#中IEdmEntityTypeReference类的典型用法代码示例。如果您正苦于以下问题:C# IEdmEntityTypeReference类的具体用法?C# IEdmEntityTypeReference怎么用?C# IEdmEntityTypeReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IEdmEntityTypeReference类属于命名空间,在下文中一共展示了IEdmEntityTypeReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteElementEpm
private void WriteElementEpm(XmlWriter writer, EpmTargetPathSegment targetSegment, EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference entityType, ref string alreadyDeclaredPrefix)
{
string prefix = targetSegment.SegmentNamespacePrefix ?? string.Empty;
writer.WriteStartElement(prefix, targetSegment.SegmentName, targetSegment.SegmentNamespaceUri);
if (prefix.Length > 0)
{
WriteNamespaceDeclaration(writer, targetSegment, ref alreadyDeclaredPrefix);
}
foreach (EpmTargetPathSegment segment in targetSegment.SubSegments)
{
if (segment.IsAttribute)
{
this.WriteAttributeEpm(writer, segment, epmValueCache, entityType, ref alreadyDeclaredPrefix);
}
}
if (targetSegment.HasContent)
{
string str2 = this.GetEntryPropertyValueAsText(targetSegment, epmValueCache, entityType);
ODataAtomWriterUtils.WriteString(writer, str2);
}
else
{
foreach (EpmTargetPathSegment segment2 in targetSegment.SubSegments)
{
if (!segment2.IsAttribute)
{
this.WriteElementEpm(writer, segment2, epmValueCache, entityType, ref alreadyDeclaredPrefix);
}
}
}
writer.WriteEndElement();
}
示例2: Get
public static void Get(
string dataSourceName,
IEdmEntityTypeReference entityType,
EdmEntityObjectCollection collection)
{
GetDataSource(dataSourceName).Get(entityType, collection);
}
示例3: CreatingEntityInstanceContextAsync
protected override async Task CreatingEntityInstanceContextAsync(object entity, IEdmEntityTypeReference entityType, object graph, ODataSerializerContext writeContext)
{
if (entity is Customer)
{
await PreProcessCustomerAsync(entity as Customer);
}
await base.CreatingEntityInstanceContextAsync(entity, entityType, graph, writeContext);
}
示例4: EntityRangeVariable
/// <summary>
/// Creates a <see cref="EntityRangeVariable"/>.
/// </summary>
/// <param name="name"> The name of the associated any/all parameter (null if none)</param>
/// <param name="entityType">The entity type of each item in the collection that this range variable iterates over.</param>
/// <param name="navigationSource">The navigation source of the collection this node iterates over.</param>
/// <exception cref="System.ArgumentNullException">Throws if the input name or entityType is null.</exception>
public EntityRangeVariable(string name, IEdmEntityTypeReference entityType, IEdmNavigationSource navigationSource)
{
ExceptionUtils.CheckArgumentNotNull(name, "name");
ExceptionUtils.CheckArgumentNotNull(entityType, "entityType");
this.name = name;
this.entityTypeReference = entityType;
this.entityCollectionNode = null;
this.navigationSource = navigationSource;
}
示例5: GetEntryPropertyValueAsText
private string GetEntryPropertyValueAsText(EpmTargetPathSegment targetSegment, EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference entityType)
{
object propertyValue = base.ReadEntryPropertyValue(targetSegment.EpmInfo, epmValueCache, entityType);
if (propertyValue == null)
{
return string.Empty;
}
return EpmWriterUtils.GetPropertyValueAsText(propertyValue);
}
示例6: WriteAttributeEpm
private void WriteAttributeEpm(XmlWriter writer, EpmTargetPathSegment targetSegment, EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference entityType, ref string alreadyDeclaredPrefix)
{
string str = this.GetEntryPropertyValueAsText(targetSegment, epmValueCache, entityType);
string prefix = targetSegment.SegmentNamespacePrefix ?? string.Empty;
writer.WriteAttributeString(prefix, targetSegment.AttributeName, targetSegment.SegmentNamespaceUri, str);
if (prefix.Length > 0)
{
WriteNamespaceDeclaration(writer, targetSegment, ref alreadyDeclaredPrefix);
}
}
示例7: Get
public void Get(IEdmEntityTypeReference entityType, EdmEntityObjectCollection collection)
{
EdmEntityObject entity = new EdmEntityObject(entityType);
entity.TrySetPropertyValue("Name", "Foo");
entity.TrySetPropertyValue("ID", 100);
collection.Add(entity);
entity = new EdmEntityObject(entityType);
entity.TrySetPropertyValue("Name", "Bar");
entity.TrySetPropertyValue("ID", 101);
collection.Add(entity);
}
示例8: ValidateEntityTypeIsAssignable
/// <summary>
/// Validates that the <paramref name="payloadEntityTypeReference"/> is assignable to the <paramref name="expectedEntityTypeReference"/>
/// and fails if it's not.
/// </summary>
/// <param name="expectedEntityTypeReference">The expected entity type reference, the base type of the entities expected.</param>
/// <param name="payloadEntityTypeReference">The payload entity type reference to validate.</param>
internal static void ValidateEntityTypeIsAssignable(IEdmEntityTypeReference expectedEntityTypeReference, IEdmEntityTypeReference payloadEntityTypeReference)
{
Debug.Assert(expectedEntityTypeReference != null, "expectedEntityTypeReference != null");
Debug.Assert(payloadEntityTypeReference != null, "payloadEntityTypeReference != null");
// Entity types must be assignable
if (!EdmLibraryExtensions.IsAssignableFrom(expectedEntityTypeReference.EntityDefinition(), payloadEntityTypeReference.EntityDefinition()))
{
throw new ODataException(Strings.ValidationUtils_EntryTypeNotAssignableToExpectedType(payloadEntityTypeReference.ODataFullName(), expectedEntityTypeReference.ODataFullName()));
}
}
示例9: EntityInstanceContext
private EntityInstanceContext(ODataSerializerContext serializerContext, IEdmEntityTypeReference entityType, IEdmStructuredObject edmObject)
{
if (serializerContext == null)
{
throw Error.ArgumentNull("serializerContext");
}
SerializerContext = serializerContext;
EntityType = entityType.EntityDefinition();
EdmObject = edmObject;
}
示例10: EntityInstanceContext
private EntityInstanceContext(ODataSerializerContext serializerContext, IEdmEntityTypeReference entityType, IEdmEntityObject edmObject, string assemblyName)
{
if (serializerContext == null)
{
throw Error.ArgumentNull("serializerContext");
}
AssemblyName = assemblyName;
SerializerContext = serializerContext;
EntityType = entityType.EntityDefinition();
EdmObject = edmObject;
}
示例11: WriteEntryEpm
private void WriteEntryEpm(XmlWriter writer, EpmTargetTree epmTargetTree, EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference entityType)
{
EpmTargetPathSegment nonSyndicationRoot = epmTargetTree.NonSyndicationRoot;
if (nonSyndicationRoot.SubSegments.Count != 0)
{
foreach (EpmTargetPathSegment segment2 in nonSyndicationRoot.SubSegments)
{
string alreadyDeclaredPrefix = null;
this.WriteElementEpm(writer, segment2, epmValueCache, entityType, ref alreadyDeclaredPrefix);
}
}
}
示例12: WriteEntryEpm
/// <summary>
/// Writes the custom mapped EPM properties to an XML writer which is expected to be positioned such to write
/// a child element of the entry element.
/// </summary>
/// <param name="writer">The XmlWriter to write to.</param>
/// <param name="epmTargetTree">The EPM target tree to use.</param>
/// <param name="epmValueCache">The entry properties value cache to use to access the properties.</param>
/// <param name="entityType">The type of the entry.</param>
/// <param name="atomOutputContext">The output context currently in use.</param>
internal static void WriteEntryEpm(
XmlWriter writer,
EpmTargetTree epmTargetTree,
EntryPropertiesValueCache epmValueCache,
IEdmEntityTypeReference entityType,
ODataAtomOutputContext atomOutputContext)
{
DebugUtils.CheckNoExternalCallers();
EpmCustomWriter epmWriter = new EpmCustomWriter(atomOutputContext);
epmWriter.WriteEntryEpm(writer, epmTargetTree, epmValueCache, entityType);
}
示例13: WriteEntryEpm
/// <summary>
/// Writes the syndication part of EPM for an entry into ATOM metadata OM.
/// </summary>
/// <param name="epmTargetTree">The EPM target tree to use.</param>
/// <param name="epmValueCache">The entry properties value cache to use to access the properties.</param>
/// <param name="type">The type of the entry.</param>
/// <param name="atomOutputContext">The output context currently in use.</param>
/// <returns>The ATOM metadata OM with the EPM values populated.</returns>
internal static AtomEntryMetadata WriteEntryEpm(
EpmTargetTree epmTargetTree,
EntryPropertiesValueCache epmValueCache,
IEdmEntityTypeReference type,
ODataAtomOutputContext atomOutputContext)
{
DebugUtils.CheckNoExternalCallers();
Debug.Assert(epmTargetTree != null, "epmTargetTree != null");
Debug.Assert(epmValueCache != null, "epmValueCache != null");
Debug.Assert(type != null, "For any EPM to exist the metadata must be available.");
EpmSyndicationWriter epmWriter = new EpmSyndicationWriter(epmTargetTree, atomOutputContext);
return epmWriter.WriteEntryEpm(epmValueCache, type);
}
示例14: ReadFeed
/// <summary>
/// Deserializes the given <paramref name="feed"/> under the given <paramref name="readContext"/>.
/// </summary>
/// <param name="feed">The feed to deserialize.</param>
/// <param name="readContext">The deserializer context.</param>
/// <param name="elementType">The element type of the feed being read.</param>
/// <returns>The deserialized feed object.</returns>
public virtual IEnumerable ReadFeed(ODataFeedWithEntries feed, IEdmEntityTypeReference elementType, ODataDeserializerContext readContext)
{
ODataEdmTypeDeserializer deserializer = DeserializerProvider.GetEdmTypeDeserializer(elementType);
if (deserializer == null)
{
throw new SerializationException(
Error.Format(SRResources.TypeCannotBeDeserialized, elementType.FullName(), typeof(ODataMediaTypeFormatter).Name));
}
foreach (ODataEntryWithNavigationLinks entry in feed.Entries)
{
yield return deserializer.ReadInline(entry, elementType, readContext);
}
}
示例15: Get
public void Get(IEdmEntityTypeReference entityType, EdmEntityObjectCollection collection)
{
EdmEntityObject entity = new EdmEntityObject(entityType);
entity.TrySetPropertyValue("Name", "Foo");
entity.TrySetPropertyValue("ID", 100);
entity.TrySetPropertyValue("School", Createchool(99, new DateTimeOffset(2016, 1, 19, 1, 2, 3, TimeSpan.Zero), entity.ActualEdmType));
collection.Add(entity);
entity = new EdmEntityObject(entityType);
entity.TrySetPropertyValue("Name", "Bar");
entity.TrySetPropertyValue("ID", 101);
entity.TrySetPropertyValue("School", Createchool(99, new DateTimeOffset(1978, 11, 15, 1, 2, 3, TimeSpan.Zero), entity.ActualEdmType));
collection.Add(entity);
}