public void Default_nullability_of_property_is_based_on_nullability_of_CLR_type_and_property_being_part_of_primary_key() { var entityType = new Model().AddEntityType(typeof(object)); var stringProperty = entityType.AddProperty("stringName", typeof(string)); var nullableIntProperty = entityType.AddProperty("nullableIntName", typeof(int?)); var intProperty = entityType.AddProperty("intName", typeof(int)); Assert.Null(stringProperty.IsNullable); Assert.True(((IProperty)stringProperty).IsNullable); Assert.Null(stringProperty.IsNullable); Assert.True(((IProperty)nullableIntProperty).IsNullable); Assert.Null(intProperty.IsNullable); Assert.False(((IProperty)intProperty).IsNullable); entityType.SetPrimaryKey(stringProperty); Assert.Null(stringProperty.IsNullable); Assert.False(((IProperty)stringProperty).IsNullable); }