I've just ran into an unexpected behaviour for Entity framework entities in use with ASP.NET MVC application with SQL Server as datastore. For a column marked as not null allowed I did not set up data annotation Required attribute inside the entities' metadata partial class (I was under impression that I had to for all properties that I wish to make mandatory) but after the POST from my view the controller action returned to the same view as a result of this check
        // check for errors
        if (!ViewData.ModelState.IsValid)
            return View(invoice);
with a description that a property should not be null. I deliberately posted the textbox for the property empty and I have no custom (manual) Data Annotation attributes in place for this property.
This is the EF wizard generated code for this property
    [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
    [DataMemberAttribute()]
    public global::System.DateTime PayDate
    {
        get
        {
            return _PayDate;
        }
        set
        {
            OnPayDateChanging(value);
            ReportPropertyChanging("PayDate");
            _PayDate = StructuralObject.SetValidValue(value);
            ReportPropertyChanged("PayDate");
            OnPayDateChanged();
        }
    }
    private global::System.DateTime _PayDate;
    partial void OnPayDateChanging(global::System.DateTime value);
    partial void OnPayDateChanged();
Is it the IsNullable attribute's fault for this kind of behaviour? Let me be clear that if it indeed is so, then this is quite nice, though I haven't noticed it before and would like to verify if that's the right behaviour or do I have something messed up there?