本文整理汇总了C#中IEdmEntityTypeReference类的典型用法代码示例。如果您正苦于以下问题:C# IEdmEntityTypeReference类的具体用法?C# IEdmEntityTypeReference怎么用?C# IEdmEntityTypeReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEdmEntityTypeReference类属于命名空间,在下文中一共展示了IEdmEntityTypeReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:nickchal,项目名称:pash,代码行数:32,代码来源:EpmCustomWriter.cs
示例2: Get
public static void Get(
string dataSourceName,
IEdmEntityTypeReference entityType,
EdmEntityObjectCollection collection)
{
GetDataSource(dataSourceName).Get(entityType, collection);
}
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:7,代码来源:DataSourceProvider.cs
示例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);
}
开发者ID:joshcomley,项目名称:WebApi,代码行数:8,代码来源:SampleODataSerializerProvider.cs
示例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;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:16,代码来源:EntityRangeVariable.cs
示例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);
}
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:EpmCustomWriter.cs
示例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);
}
}
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:EpmCustomWriter.cs
示例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);
}
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:11,代码来源:AnotherDataSource.cs
示例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()));
}
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:17,代码来源:ValidationUtils.cs
示例9: EntityInstanceContext
private EntityInstanceContext(ODataSerializerContext serializerContext, IEdmEntityTypeReference entityType, IEdmStructuredObject edmObject)
{
if (serializerContext == null)
{
throw Error.ArgumentNull("serializerContext");
}
SerializerContext = serializerContext;
EntityType = entityType.EntityDefinition();
EdmObject = edmObject;
}
开发者ID:karensyc,项目名称:aspnetwebstack,代码行数:11,代码来源:EntityInstanceContext.cs
示例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;
}
开发者ID:joshcomley,项目名称:WebApi,代码行数:12,代码来源:EntityInstanceContext.cs
示例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);
}
}
}
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:EpmCustomWriter.cs
示例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);
}
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:21,代码来源:EpmCustomWriter.cs
示例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);
}
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:22,代码来源:EpmSyndicationWriter.cs
示例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);
}
}
开发者ID:huangw-t,项目名称:aspnetwebstack,代码行数:21,代码来源:ODataFeedDeserializer.cs
示例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);
}
开发者ID:chinadragon0515,项目名称:ODataSamples,代码行数:15,代码来源:AnotherDataSource.cs
示例16: Get
public void Get(IEdmEntityTypeReference entityType, EdmEntityObjectCollection collection)
{
EdmEntityObject entity = new EdmEntityObject(entityType);
entity.TrySetPropertyValue("Name", "abc");
entity.TrySetPropertyValue("ID", 1);
entity.TrySetPropertyValue("DetailInfo", CreateDetailInfo(88, "abc_detailinfo", entity.ActualEdmType));
collection.Add(entity);
entity = new EdmEntityObject(entityType);
entity.TrySetPropertyValue("Name", "def");
entity.TrySetPropertyValue("ID", 2);
entity.TrySetPropertyValue("DetailInfo", CreateDetailInfo(99, "def_detailinfo", entity.ActualEdmType));
collection.Add(entity);
}
开发者ID:chinadragon0515,项目名称:ODataSamples,代码行数:15,代码来源:MyDataSource.cs
示例17: CreateStructuredEdmValue
internal static IEdmValue CreateStructuredEdmValue(ODataEntry entry, IEdmEntitySet entitySet, IEdmEntityTypeReference entityType)
{
if (entitySet != null)
{
object typeAnnotation = ReflectionUtils.CreateInstance(
odataTypeAnnotationType,
new Type[] { typeof(IEdmEntitySet), typeof(IEdmEntityTypeReference) },
entitySet, entityType);
entry.SetAnnotation(typeAnnotation);
}
return (IEdmValue)ReflectionUtils.CreateInstance(
odataEdmStructuredValueType,
new Type[] { typeof(ODataEntry) },
entry);
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:16,代码来源:ODataEdmValueUtils.cs
示例18: ReadEntryPropertyValue
/// <summary>
/// Reads a property value starting on an entry.
/// </summary>
/// <param name="epmInfo">The EPM info which describes the mapping for which to read the property value.</param>
/// <param name="epmValueCache">The EPM value cache for the entry to read from.</param>
/// <param name="entityType">The type of the entry.</param>
/// <returns>The value of the property (may be null), or null if the property itself was not found due to one of its parent properties being null.</returns>
protected object ReadEntryPropertyValue(
EntityPropertyMappingInfo epmInfo,
EntryPropertiesValueCache epmValueCache,
IEdmEntityTypeReference entityType)
{
Debug.Assert(epmInfo != null, "epmInfo != null");
Debug.Assert(epmInfo.PropertyValuePath != null, "The PropertyValuePath should have been initialized by now.");
Debug.Assert(epmInfo.PropertyValuePath.Length > 0, "The PropertyValuePath must not be empty for an entry property.");
Debug.Assert(entityType != null, "entityType != null");
// TODO - It might be possible to avoid the "value" type checks below if we do property value validation based on the type
return this.ReadPropertyValue(
epmInfo,
epmValueCache.EntryProperties,
0,
entityType,
epmValueCache);
}
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:25,代码来源:EpmWriter.cs
示例19: SelectExpandNode
/// <summary>
/// Creates a new instance of the <see cref="SelectExpandNode"/> class describing the set of structural properties,
/// navigation properties, and actions to select and expand for the given <paramref name="selectExpandClause"/>.
/// </summary>
/// <param name="selectExpandClause">The parsed $select and $expand query options.</param>
/// <param name="entityType">The entity type of the entry that would be written.</param>
/// <param name="model">The <see cref="IEdmModel"/> that contains the given entity type.</param>
public SelectExpandNode(SelectExpandClause selectExpandClause, IEdmEntityTypeReference entityType, IEdmModel model)
: this()
{
if (entityType == null)
{
throw Error.ArgumentNull("entityType");
}
if (model == null)
{
throw Error.ArgumentNull("model");
}
HashSet<IEdmStructuralProperty> allStructuralProperties = new HashSet<IEdmStructuralProperty>(entityType.StructuralProperties());
HashSet<IEdmNavigationProperty> allNavigationProperties = new HashSet<IEdmNavigationProperty>(entityType.NavigationProperties());
HashSet<IEdmFunctionImport> allActions = new HashSet<IEdmFunctionImport>(model.GetAvailableProcedures(entityType.EntityDefinition()));
if (selectExpandClause == null)
{
SelectedStructuralProperties = allStructuralProperties;
SelectedNavigationProperties = allNavigationProperties;
SelectedActions = allActions;
}
else
{
if (selectExpandClause.AllSelected)
{
SelectedStructuralProperties = allStructuralProperties;
SelectedNavigationProperties = allNavigationProperties;
SelectedActions = allActions;
}
else
{
BuildSelections(selectExpandClause, allStructuralProperties, allNavigationProperties, allActions);
}
BuildExpansions(selectExpandClause, allNavigationProperties);
// remove expanded navigation properties from the selected navigation properties.
SelectedNavigationProperties.ExceptWith(ExpandedNavigationProperties.Keys);
}
}
开发者ID:samgithub-duplicate,项目名称:aspnetwebstack,代码行数:48,代码来源:SelectExpandNode.cs
示例20: BuildSelectExpandNode
/// <summary>
/// Builds the <see cref="SelectExpandNode"/> describing the set of structural properties and navigation properties and actions to select
/// and navigation properties to expand while writing an entry of type <paramref name="entityType"/> for the given
/// <paramref name="selectExpandClause"/>.
/// </summary>
/// <param name="selectExpandClause">The parsed $select and $expand query options.</param>
/// <param name="entityType">The entity type of the entry that would be written.</param>
/// <param name="model">The <see cref="IEdmModel"/> that contains the given entity type.</param>
/// <returns>The built <see cref="SelectExpandNode"/>.</returns>
public static SelectExpandNode BuildSelectExpandNode(SelectExpandClause selectExpandClause, IEdmEntityTypeReference entityType, IEdmModel model)
{
if (entityType == null)
{
throw Error.ArgumentNull("entityType");
}
if (model == null)
{
throw Error.ArgumentNull("model");
}
SelectExpandNode selectExpandNode = new SelectExpandNode();
if (selectExpandClause != null && selectExpandClause.Expansion != null)
{
selectExpandNode.BuildExpansions(selectExpandClause.Expansion, entityType);
}
selectExpandNode.BuildSelections(selectExpandClause == null ? null : selectExpandClause.Selection, entityType, model);
// remove expanded navigation properties from the selected navigation properties.
IEnumerable<IEdmNavigationProperty> expandedNavigationProperties = selectExpandNode.ExpandedNavigationProperties.Keys;
selectExpandNode.SelectedNavigationProperties.ExceptWith(expandedNavigationProperties);
return selectExpandNode;
}
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:33,代码来源:SelectExpandNode.cs
注:本文中的IEdmEntityTypeReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论