本文整理汇总了C#中IEdmEntityType类的典型用法代码示例。如果您正苦于以下问题:C# IEdmEntityType类的具体用法?C# IEdmEntityType怎么用?C# IEdmEntityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEdmEntityType类属于命名空间,在下文中一共展示了IEdmEntityType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CsdlSemanticsRecordExpression
public CsdlSemanticsRecordExpression(CsdlRecordExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(schema, expression)
{
this.declaredTypeCache = new Cache<CsdlSemanticsRecordExpression, IEdmStructuredTypeReference>();
this.propertiesCache = new Cache<CsdlSemanticsRecordExpression, IEnumerable<IEdmPropertyConstructor>>();
this.expression = expression;
this.bindingContext = bindingContext;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:CsdlSemanticsRecordExpression.cs
示例2: ODataWriterCore
/// <summary>
/// Constructor.
/// </summary>
/// <param name="outputContext">The output context to write to.</param>
/// <param name="navigationSource">The navigation source we are going to write entities for.</param>
/// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
/// <param name="writingFeed">True if the writer is created for writing a feed; false when it is created for writing an entry.</param>
/// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param>
protected ODataWriterCore(
ODataOutputContext outputContext,
IEdmNavigationSource navigationSource,
IEdmEntityType entityType,
bool writingFeed,
IODataReaderWriterListener listener = null)
{
Debug.Assert(outputContext != null, "outputContext != null");
this.outputContext = outputContext;
this.writingFeed = writingFeed;
// create a collection validator when writing a top-level feed and a user model is present
if (this.writingFeed && this.outputContext.Model.IsUserModel())
{
this.feedValidator = new FeedWithoutExpectedTypeValidator();
}
if (navigationSource != null && entityType == null)
{
entityType = this.outputContext.EdmTypeResolver.GetElementType(navigationSource);
}
ODataUri odataUri = outputContext.MessageWriterSettings.ODataUri.Clone();
// Remove key for top level entry
if (!writingFeed && odataUri != null && odataUri.Path != null)
{
odataUri.Path = odataUri.Path.TrimEndingKeySegment();
}
this.listener = listener;
this.scopes.Push(new Scope(WriterState.Start, /*item*/null, navigationSource, entityType, /*skipWriting*/false, outputContext.MessageWriterSettings.SelectedProperties, odataUri));
}
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:43,代码来源:ODataWriterCore.cs
示例3: CsdlSemanticsCollectionExpression
public CsdlSemanticsCollectionExpression(CsdlCollectionExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(schema, expression)
{
this.declaredTypeCache = new Cache<CsdlSemanticsCollectionExpression, IEdmTypeReference>();
this.elementsCache = new Cache<CsdlSemanticsCollectionExpression, IEnumerable<IEdmExpression>>();
this.expression = expression;
this.bindingContext = bindingContext;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:CsdlSemanticsCollectionExpression.cs
示例4: HasDefaultStream
public static bool HasDefaultStream(this IEdmModel model, IEdmEntityType entityType)
{
bool flag;
ExceptionUtils.CheckArgumentNotNull<IEdmModel>(model, "model");
ExceptionUtils.CheckArgumentNotNull<IEdmEntityType>(entityType, "entityType");
return (TryGetBooleanAnnotation(model, entityType, "HasStream", true, out flag) && flag);
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:ODataUtils.cs
示例5: ResolveKeys
public override IEnumerable<KeyValuePair<string, object>> ResolveKeys(
IEdmEntityType type,
IList<string> positionalValues,
Func<IEdmTypeReference, string, object> convertFunc)
{
return stringAsEnum.ResolveKeys(type, positionalValues, convertFunc);
}
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:7,代码来源:Resolvers.cs
示例6: EdmEntitySetBase
/// <summary>
/// Initializes a new instance of the <see cref="EdmEntitySetBase"/> class.
/// </summary>
/// <param name="name">Name of the entity set base.</param>
/// <param name="elementType">The entity type of the elements in this entity set base.</param>
protected EdmEntitySetBase(string name, IEdmEntityType elementType)
: base(name)
{
EdmUtil.CheckArgumentNull(elementType, "elementType");
this.type = new EdmCollectionType(new EdmEntityTypeReference(elementType, false));
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:12,代码来源:EdmEntitySetBase.cs
示例7: CastPathSegment
/// <summary>
/// Initializes a new instance of the <see cref="CastPathSegment" /> class.
/// </summary>
/// <param name="previous">The previous segment in the path.</param>
/// <param name="castType">The type of the cast.</param>
public CastPathSegment(ODataPathSegment previous, IEdmEntityType castType)
: base(previous)
{
if (castType == null)
{
throw Error.ArgumentNull("cast");
}
IEdmType previousEdmType = previous.EdmType;
if (previousEdmType == null)
{
throw Error.InvalidOperation(SRResources.PreviousSegmentEdmTypeCannotBeNull);
}
if (previousEdmType.TypeKind == EdmTypeKind.Collection)
{
EdmType = castType.GetCollection();
}
else
{
EdmType = castType;
}
EntitySet = previous.EntitySet;
CastType = castType;
}
开发者ID:marojeri,项目名称:aspnetwebstack,代码行数:31,代码来源:CastPathSegment.cs
示例8: CsdlSemanticsPropertyReferenceExpression
public CsdlSemanticsPropertyReferenceExpression(CsdlPropertyReferenceExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(schema, expression)
{
this.baseCache = new Cache<CsdlSemanticsPropertyReferenceExpression, IEdmExpression>();
this.elementCache = new Cache<CsdlSemanticsPropertyReferenceExpression, IEdmProperty>();
this.expression = expression;
this.bindingContext = bindingContext;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:CsdlSemanticsPropertyReferenceExpression.cs
示例9: EntityPropertyMappingInfo
internal EntityPropertyMappingInfo(EntityPropertyMappingAttribute attribute, IEdmEntityType definingType, IEdmEntityType actualTypeDeclaringProperty)
{
this.attribute = attribute;
this.definingType = definingType;
this.actualPropertyType = actualTypeDeclaringProperty;
this.isSyndicationMapping = this.attribute.TargetSyndicationItem != SyndicationItemProperty.CustomProperty;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:EntityPropertyMappingInfo.cs
示例10: ValidateEntry
/// <summary>
/// Validates the type of an entry in a top-level feed.
/// </summary>
/// <param name="entityType">The type of the entry.</param>
internal void ValidateEntry(IEdmEntityType entityType)
{
DebugUtils.CheckNoExternalCallers();
Debug.Assert(entityType != null, "entityType != null");
// If we don't have a type, store the type of the first item.
if (this.itemType == null)
{
this.itemType = entityType;
}
// Validate the expected and actual types.
if (this.itemType.IsEquivalentTo(entityType))
{
return;
}
// If the types are not equivalent, make sure they have a common base type.
IEdmType commonBaseType = EdmLibraryExtensions.GetCommonBaseType(this.itemType, entityType);
if (commonBaseType == null)
{
throw new ODataException(Strings.FeedWithoutExpectedTypeValidator_IncompatibleTypes(entityType.ODataFullName(), this.itemType.ODataFullName()));
}
this.itemType = (IEdmEntityType)commonBaseType;
}
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:30,代码来源:FeedWithoutExpectedTypeValidator.cs
示例11: 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="writeContext"/>.
/// </summary>
/// <param name="entityType">The entity type of the entry that would be written.</param>
/// <param name="writeContext">The serializer context to be used while creating the collection.</param>
/// <remarks>The default constructor is for unit testing only.</remarks>
public SelectExpandNode(IEdmEntityType entityType, ODataSerializerContext writeContext)
: this(writeContext.SelectExpandClause, entityType, writeContext.Model)
{
var queryOptionParser = new ODataQueryOptionParser(
writeContext.Model,
entityType,
writeContext.NavigationSource,
_extraQueryParameters);
var selectExpandClause = queryOptionParser.ParseSelectAndExpand();
if (selectExpandClause != null)
{
foreach (SelectItem selectItem in selectExpandClause.SelectedItems)
{
ExpandedNavigationSelectItem expandItem = selectItem as ExpandedNavigationSelectItem;
if (expandItem != null)
{
ValidatePathIsSupported(expandItem.PathToNavigationProperty);
NavigationPropertySegment navigationSegment = (NavigationPropertySegment)expandItem.PathToNavigationProperty.LastSegment;
IEdmNavigationProperty navigationProperty = navigationSegment.NavigationProperty;
if (!ExpandedNavigationProperties.ContainsKey(navigationProperty))
{
ExpandedNavigationProperties.Add(navigationProperty, expandItem.SelectAndExpand);
}
}
}
}
SelectedNavigationProperties.ExceptWith(ExpandedNavigationProperties.Keys);
}
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:36,代码来源:SelectExpandNode.cs
示例12: SelectExpandQueryOption
/// <summary>
/// Initializes a new instance of the <see cref="SelectExpandQueryOption"/> class.
/// </summary>
/// <param name="select">The $select query parameter value.</param>
/// <param name="expand">The $select query parameter value.</param>
/// <param name="context">The <see cref="ODataQueryContext"/> which contains the <see cref="IEdmModel"/> and some type information.</param>
public SelectExpandQueryOption(string select, string expand, ODataQueryContext context)
{
if (context == null)
{
throw Error.ArgumentNull("context");
}
if (String.IsNullOrEmpty(select) && String.IsNullOrEmpty(expand))
{
throw Error.Argument(SRResources.SelectExpandEmptyOrNull);
}
IEdmEntityType entityType = context.ElementType as IEdmEntityType;
if (entityType == null)
{
throw Error.Argument("context", SRResources.SelectNonEntity, context.ElementType.ToTraceString());
}
_entityType = entityType;
Context = context;
RawSelect = select;
RawExpand = expand;
Validator = new SelectExpandQueryValidator();
}
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:31,代码来源:SelectExpandQueryOption.cs
示例13: EdmDeltaModel
public EdmDeltaModel(IEdmModel source, IEdmEntityType entityType, IEnumerable<string> propertyNames)
{
_source = source;
_entityType = new EdmEntityType(entityType.Namespace, entityType.Name);
foreach (var property in entityType.StructuralProperties())
{
if (propertyNames.Contains(property.Name))
_entityType.AddStructuralProperty(property.Name, property.Type, property.DefaultValueString, property.ConcurrencyMode);
}
foreach (var property in entityType.NavigationProperties())
{
if (propertyNames.Contains(property.Name))
{
var navInfo = new EdmNavigationPropertyInfo()
{
ContainsTarget = property.ContainsTarget,
DependentProperties = property.DependentProperties(),
PrincipalProperties = property.PrincipalProperties(),
Name = property.Name,
OnDelete = property.OnDelete,
Target = property.Partner != null
? property.Partner.DeclaringEntityType()
: property.Type.TypeKind() == EdmTypeKind.Collection
? (property.Type.Definition as IEdmCollectionType).ElementType.Definition as IEdmEntityType
: property.Type.TypeKind() == EdmTypeKind.Entity
? property.Type.Definition as IEdmEntityType
: null,
TargetMultiplicity = property.TargetMultiplicity(),
};
_entityType.AddUnidirectionalNavigation(navInfo);
}
}
}
开发者ID:ErikWitkowski,项目名称:Simple.OData.Client,代码行数:35,代码来源:EdmDeltaModel.cs
示例14: CreateODataEntry
/// <summary>
/// Creates a new ODataEntry from the specified entity set, instance, and type.
/// </summary>
/// <param name="entitySet">Entity set for the new entry.</param>
/// <param name="value">Entity instance for the new entry.</param>
/// <param name="entityType">Entity type for the new entry.</param>
/// <returns>New ODataEntry with the specified entity set and type, property values from the specified instance.</returns>
internal static ODataEntry CreateODataEntry(IEdmEntitySet entitySet, IEdmStructuredValue value, IEdmEntityType entityType)
{
var entry = new ODataEntry();
entry.SetAnnotation(new ODataTypeAnnotation(entitySet, entityType));
entry.Properties = value.PropertyValues.Select(p =>
{
object propertyValue;
if (p.Value.ValueKind == EdmValueKind.Null)
{
propertyValue = null;
}
else if (p.Value is IEdmPrimitiveValue)
{
propertyValue = ((IEdmPrimitiveValue)p.Value).ToClrValue();
}
else
{
Assert.Fail("Test only currently supports creating ODataEntry from IEdmPrimitiveValue instances.");
return null;
}
return new ODataProperty() { Name = p.Name, Value = propertyValue };
});
return entry;
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:33,代码来源:TestUtils.cs
示例15: GetIdentifierPrefix
private string GetIdentifierPrefix(IEdmEntityType entityType)
{
if (entityType.BaseEntityType() != null)
{
return GetIdentifierPrefix(entityType.BaseEntityType());
}
TypeMapping existingMapping;
if (_typeUriMap.TryGetValue(entityType.FullName(), out existingMapping))
{
return existingMapping.IdentifierPrefix;
}
var keyList = entityType.DeclaredKey.ToList();
if (keyList.Count != 1)
{
// Ignore this entity
// TODO: Log an error
return null;
}
var identifierPrefix = GetStringAnnotationValue(keyList.First(), AnnotationsNamespace, "IdentifierPrefix");
if (identifierPrefix == null)
{
// TODO: Log an error
}
return identifierPrefix;
}
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:25,代码来源:SparqlMap.cs
示例16: CsdlSemanticsAssertTypeExpression
public CsdlSemanticsAssertTypeExpression(CsdlAssertTypeExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(schema, expression)
{
this.operandCache = new Cache<CsdlSemanticsAssertTypeExpression, IEdmExpression>();
this.typeCache = new Cache<CsdlSemanticsAssertTypeExpression, IEdmTypeReference>();
this.expression = expression;
this.bindingContext = bindingContext;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:CsdlSemanticsAssertTypeExpression.cs
示例17: CsdlSemanticsApplyExpression
public CsdlSemanticsApplyExpression(CsdlApplyExpression expression, IEdmEntityType bindingContext, CsdlSemanticsSchema schema)
: base(schema, expression)
{
this.expression = expression;
this.bindingContext = bindingContext;
this.schema = schema;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:7,代码来源:CsdlSemanticsApplyExpression.cs
示例18: EdmEntityType
public EdmEntityType(string namespaceName, string name, IEdmEntityType baseType, bool isAbstract, bool isOpen) : base(isAbstract, isOpen, baseType)
{
EdmUtil.CheckArgumentNull<string>(namespaceName, "namespaceName");
EdmUtil.CheckArgumentNull<string>(name, "name");
this.namespaceName = namespaceName;
this.name = name;
}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:EdmEntityType.cs
示例19: CsdlSemanticsLabeledExpression
public CsdlSemanticsLabeledExpression(string name, CsdlExpressionBase element, IEdmEntityType bindingContext, CsdlSemanticsSchema schema) : base(element)
{
this.expressionCache = new Cache<CsdlSemanticsLabeledExpression, IEdmExpression>();
this.name = name;
this.sourceElement = element;
this.bindingContext = bindingContext;
this.schema = schema;
}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:CsdlSemanticsLabeledExpression.cs
示例20: ParserExtModel
public ParserExtModel()
{
Person = (IEdmEntityType)Model.FindType("TestNS.Person");
Pet = Model.FindType("TestNS.Pet");
Fish = Model.FindType("TestNS.Fish");
People = Model.FindDeclaredEntitySet("People");
PetSet = Model.FindDeclaredEntitySet("PetSet");
}
开发者ID:chinadragon0515,项目名称:ODataSamples,代码行数:8,代码来源:Models.cs
注:本文中的IEdmEntityType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论