Esempio n. 1
0
        public void GetDefaultValue_NonNullableEntity()
        {
            IEdmTypeReference nonNullableEntityType = new EdmEntityTypeReference(new EdmEntityType("NS", "Entity"), isNullable: false);

            var result = EdmStructuredObject.GetDefaultValue(nonNullableEntityType);

            var entityObject = Assert.IsType <EdmEntityObject>(result);

            Assert.Equal(nonNullableEntityType, entityObject.GetEdmType(), new EdmTypeReferenceEqualityComparer());
        }
Esempio n. 2
0
        public void GetDefaultValue_NonNullableEntityCollection()
        {
            IEdmTypeReference           elementType          = new EdmEntityTypeReference(new EdmEntityType("NS", "Entity"), isNullable: true);
            IEdmCollectionTypeReference entityCollectionType = new EdmCollectionTypeReference(new EdmCollectionType(elementType));

            var result = EdmStructuredObject.GetDefaultValue(entityCollectionType);

            var entityCollectionObject = Assert.IsType <EdmEntityObjectCollection>(result);

            Assert.Equal(entityCollectionType, entityCollectionObject.GetEdmType(), new EdmTypeReferenceEqualityComparer());
        }
Esempio n. 3
0
 public void GetClrTypeForUntypedDelta(IEdmTypeReference edmType, Type expectedType)
 {
     Assert.Equal(expectedType, EdmStructuredObject.GetClrTypeForUntypedDelta(edmType));
 }
Esempio n. 4
0
 public void GetDefaultValue(IEdmTypeReference edmType, object expectedResult)
 {
     Assert.Equal(expectedResult, EdmStructuredObject.GetDefaultValue(edmType));
 }
Esempio n. 5
0
 internal static void SetEntityPropertyValue(this DbDataReader reader, int fieldIndex, EdmStructuredObject entity)
 {
     string name = reader.GetName(fieldIndex);
     if (reader.IsDBNull(fieldIndex))
     {
         entity.TrySetPropertyValue(name, null);
         return;
     }
     if (reader.GetFieldType(fieldIndex) == typeof(DateTime))
     {
         entity.TrySetPropertyValue(name, new DateTimeOffset(reader.GetDateTime(fieldIndex)));
     }
     else
     {
         entity.TrySetPropertyValue(name, reader.GetValue(fieldIndex));
     }
 }