Problem with EF and VB: can't set a property to "" RRS feed

  • Question

  • Using EF v 4.1.  

    Of course, "" is not null, and it should be possible to assign "" to a property.  I have a property N_ADD_ID that corresponds to a non-nullable field.  But the EF-generated "setter" for property N_ADD_ID does this:


                If (_N_ADD_ID <> Value) Then
                    _N_ADD_ID = StructuralObject.SetValidValue(Value, False)
                End If
            End Set


    The problem is: when _N_ADD_ID is Nothing and Value is "", "If (_N_ADD_ID <> Value)" returns False, so _N_ADD_ID can never get changed from Nothing to "".

    I think the generated code should be checking "If not (value.Equals(_N_ADD_ID))". That would return True and things would work as expected.


    • Edited by Kbd Guy Wednesday, September 21, 2011 5:38 PM
    Wednesday, September 21, 2011 5:35 PM

All replies