本文整理汇总了C#中EdmPrimitiveTypeKind类的典型用法代码示例。如果您正苦于以下问题:C# EdmPrimitiveTypeKind类的具体用法?C# EdmPrimitiveTypeKind怎么用?C# EdmPrimitiveTypeKind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EdmPrimitiveTypeKind类属于命名空间,在下文中一共展示了EdmPrimitiveTypeKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BadPrimitiveType
public BadPrimitiveType(string qualifiedName, EdmPrimitiveTypeKind primitiveKind, IEnumerable<EdmError> errors)
: base(errors)
{
this.primitiveKind = primitiveKind;
qualifiedName = qualifiedName ?? string.Empty;
EdmUtil.TryGetNamespaceNameFromQualifiedName(qualifiedName, out this.namespaceName, out this.name);
}
示例2: PrimitiveType
private PrimitiveType(Type clrType, string edmTypeName, EdmPrimitiveTypeKind primitiveKind, PrimitiveTypeConverter typeConverter, bool hasReverseMapping)
{
this.ClrType = clrType;
this.EdmTypeName = edmTypeName;
this.primitiveKind = primitiveKind;
this.TypeConverter = typeConverter;
this.HasReverseMapping = hasReverseMapping;
}
示例3: EdmPrimitiveType
public EdmPrimitiveType(EdmPrimitiveTypeKind kind)
{
this.PrimitiveKind = kind;
this.Namespace = "namespace";
this.Name = "name";
this.SchemaElementKind = EdmSchemaElementKind.None;
this.TypeKind = EdmTypeKind.None;
}
示例4: GetODataSerializer_Primitive
public void GetODataSerializer_Primitive(Type type, EdmPrimitiveTypeKind edmPrimitiveTypeKind)
{
var serializerProvider = new DefaultODataSerializerProvider(_edmModel);
var serializer = serializerProvider.GetODataPayloadSerializer(type);
Assert.NotNull(serializer);
var primitiveSerializer = Assert.IsType<ODataPrimitiveSerializer>(serializer);
Assert.Equal(primitiveSerializer.EdmType.AsPrimitive().PrimitiveKind(), edmPrimitiveTypeKind);
Assert.Equal(primitiveSerializer.ODataPayloadKind, ODataPayloadKind.Property);
}
示例5: GetODataSerializer_Primitive
public void GetODataSerializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
{
ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider(_edmModel);
ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(type);
Assert.NotNull(deserializer);
ODataRawValueDeserializer rawValueDeserializer = Assert.IsType<ODataRawValueDeserializer>(deserializer);
Assert.Equal(ODataPayloadKind.Value, rawValueDeserializer.ODataPayloadKind);
Assert.Equal(primitiveKind, rawValueDeserializer.PrimitiveTypeReference.PrimitiveDefinition().PrimitiveKind);
}
示例6: GetODataDeserializer_Primitive
public void GetODataDeserializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
{
ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, type);
Assert.NotNull(deserializer);
ODataPrimitiveDeserializer rawValueDeserializer = Assert.IsType<ODataPrimitiveDeserializer>(deserializer);
Assert.Equal(ODataPayloadKind.Property, rawValueDeserializer.ODataPayloadKind);
Assert.Equal(primitiveKind, rawValueDeserializer.EdmType.AsPrimitive().PrimitiveDefinition().PrimitiveKind);
}
示例7: GetODataSerializer_Primitive
public void GetODataSerializer_Primitive(Type type, EdmPrimitiveTypeKind edmPrimitiveTypeKind)
{
var serializerProvider = new DefaultODataSerializerProvider();
HttpRequestMessage request = new HttpRequestMessage();
var serializer = serializerProvider.GetODataPayloadSerializer(_edmModel, type, request);
Assert.NotNull(serializer);
var primitiveSerializer = Assert.IsType<ODataPrimitiveSerializer>(serializer);
Assert.Equal(primitiveSerializer.ODataPayloadKind, ODataPayloadKind.Property);
}
示例8: PromotesTo
private static bool PromotesTo(this EdmPrimitiveTypeKind startingKind, EdmPrimitiveTypeKind target)
{
if (startingKind == target)
{
return true;
}
else
{
return ExpressionTypeChecker.promotionMap[(int)startingKind, (int)target];
}
}
示例9: GetODataDeserializer_Primitive
public void GetODataDeserializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
{
ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
HttpRequestMessage request = new HttpRequestMessage();
ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, type, request);
Assert.NotNull(deserializer);
ODataPrimitiveDeserializer rawValueDeserializer = Assert.IsType<ODataPrimitiveDeserializer>(deserializer);
Assert.Equal(ODataPayloadKind.Property, rawValueDeserializer.ODataPayloadKind);
}
示例10: BadPrimitiveType
public BadPrimitiveType(string qualifiedName, EdmPrimitiveTypeKind primitiveKind, IEnumerable<EdmError> errors) : base(errors)
{
this.primitiveKind = primitiveKind;
string str = qualifiedName;
string empty = str;
if (str == null)
{
empty = string.Empty;
}
qualifiedName = empty;
EdmUtil.TryGetNamespaceNameFromQualifiedName(qualifiedName, out this.namespaceName, out this.name);
}
示例11: Constructor_SucceedsForValidPrimitiveType
public void Constructor_SucceedsForValidPrimitiveType(EdmPrimitiveTypeKind primitiveTypeKind)
{
IEdmPrimitiveType edmPrimitiveType = EdmCoreModel.Instance.SchemaElements
.OfType<IEdmPrimitiveType>()
.Where(primitiveType => primitiveType.PrimitiveKind == primitiveTypeKind)
.FirstOrDefault();
IEdmPrimitiveTypeReference edmPrimitiveTypeReference = new EdmPrimitiveTypeReference(edmPrimitiveType, false);
var serializer = new ODataPrimitiveSerializer(edmPrimitiveTypeReference);
Assert.Equal(serializer.EdmType, edmPrimitiveTypeReference);
Assert.Equal(serializer.ODataPayloadKind, ODataPayloadKind.Property);
}
示例12: PromotesTo
private static bool PromotesTo(this EdmPrimitiveTypeKind startingKind, EdmPrimitiveTypeKind target)
{
return startingKind == target || promotionMap[(int)startingKind, (int)target];
}
示例13: GetInputHtmlType
private string GetInputHtmlType(EdmPrimitiveTypeKind kind) {
switch (kind) {
case EdmPrimitiveTypeKind.Boolean:
return "checkbox";
case EdmPrimitiveTypeKind.Int32:
case EdmPrimitiveTypeKind.Double:
return "number";
default:
return "text";
}
}
示例14: GetDefaultValue
private static string GetDefaultValue(EdmPrimitiveTypeKind type) {
switch (type) {
case EdmPrimitiveTypeKind.String:
return "'0'";
case EdmPrimitiveTypeKind.Double:
return "0.0";
case EdmPrimitiveTypeKind.Int32:
return "0";
case EdmPrimitiveTypeKind.Boolean:
return "False";
default:
throw new InvalidOperationException();
}
}
示例15: AddStructuralProperty
/// <summary>
/// Creates and adds a nullable structural property to this type.
/// </summary>
/// <param name="name">Name of the property.</param>
/// <param name="type">Type of the property.</param>
/// <param name="isNullable">Flag specifying if the property is nullable.</param>
/// <returns>Created structural property.</returns>
public EdmStructuralProperty AddStructuralProperty(string name, EdmPrimitiveTypeKind type, bool isNullable)
{
EdmStructuralProperty property = new EdmStructuralProperty(this, name, EdmCoreModel.Instance.GetPrimitive(type, isNullable));
this.AddProperty(property);
return property;
}