Nullable property to entity field, Entity Framework through Code First

Just omit the [Required] attribute from the string somefield property. This will make it create a NULLable column in the db. To make int types allow NULLs in the database, they must be declared as nullable ints in the model: // an int can never be null, so it will be created as NOT NULL … Read more

Java check if boolean is null

boolean can only be true or false because it’s a primitive datatype (+ a boolean variables default value is false). You can use the class Boolean instead if you want to use null values. Boolean is a reference type, that’s the reason you can assign null to a Boolean “variable”. Example: Boolean testvar = null; … Read more

Invalid cast from ‘System.Int32’ to ‘System.Nullable`1[[System.Int32, mscorlib]]

You have to use Nullable.GetUnderlyingType to get underlying type of Nullable. This is the method I use to overcome limitation of ChangeType for Nullable public static T ChangeType<T>(object value) { var t = typeof(T); if (t.IsGenericType && t.GetGenericTypeDefinition().Equals(typeof(Nullable<>))) { if (value == null) { return default(T); } t = Nullable.GetUnderlyingType(t); } return (T)Convert.ChangeType(value, t); } … Read more

Why doesn’t incrementing Nullable throw an exception?

You’re observing the effects of a lifted operator. From section 7.3.7 of the C# 5 specification: Lifted operators permit predefined and user-defined operators that operate on non-nullable value types to also be used with nullable forms of those types. Lifted operators are constructed from predefined and user-defined operators that meet certain requirements, as described in … Read more

How to use nonnull and nullable Objective-C keywords in block-based API method

This seems to be working – (void)methodWithArg:(nonnull NSString *)arg1 andArg:(nullable NSString *)arg2 completionHandler:(nullable void (^) (NSArray * _Nullable results, NSError * _Nonnull error))completionHandler You need to specify nullability both for the block and its parameters… EDIT: For more information, see Swift Blog

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)