示例#1
0
        private DataColumn Create(ITypeProperty property)
        {
            var name = property.Name;
            var type = property.Type;

            var underlyingNullableType = Nullable.GetUnderlyingType(type);
            var isNullable             = underlyingNullableType != null;
            var dataColumnType         = isNullable ? underlyingNullableType : type;

            var dataColumn = new DataColumn(name, dataColumnType);

            dataColumn.AllowDBNull = isNullable || !type.IsValueType;

            return(dataColumn);
        }
示例#2
0
 public ObjectProperty(ITypeProperty typeProperty, object value)
 {
     TypeProperty = typeProperty;
     Value        = value;
 }
 public static void AssertCompiled(this ITypeProperty typeProperty, string expectedName, Type expectedType)
 {
     Assert.AreEqual(expectedName, typeProperty.Name);
     Assert.AreEqual(TypeReference.Create(expectedType), typeProperty.TypeReference);
 }
 public static void AssertList(this ITypeProperty typeProperty, string expectedName, ITypeReference expectedListTypeReference)
 {
     Assert.AreEqual(expectedName, typeProperty.Name);
     Assert.IsTrue(typeProperty.TypeReference.IsList);
     Assert.AreEqual(expectedListTypeReference, typeProperty.TypeReference.GetEnumerableContentType());
 }
 public static void AssertList(this ITypeProperty typeProperty, string expectedName, Type expectedListType)
 {
     typeProperty.AssertList(expectedName, TypeReference.Create(expectedListType));
 }
 public static void AssertGenerated(this ITypeProperty typeProperty, string expectedName)
 {
     Assert.AreEqual(expectedName, typeProperty.Name);
     Assert.IsTrue(typeProperty.TypeReference.IsGenerated);
 }