google-code-export / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
Other
0 stars 0 forks source link

DbMetal generates wrong code for nullable type properties. #249

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See also: 
http://groups.google.com/group/dblinq/browse_thread/thread/2c1a7f603fd2b89c

What steps will reproduce the problem?
1. Run:

    DbMetal.exe /provider:Sqlite \
        /conn "Data Source=tests/Northwind.db3" /code:f.vb

2. Look at e.g. Employee.BirthDate. It'll be similar to:

    <Column(Storage:="_birthDate", Name:="BirthDate", _
        DbType:="datetime", AutoSync:=AutoSync.Never),  _
     DebuggerNonUserCode()>  _
    Public Property BirthDate() As System.Nullable(Of Date)
        Get
            Return Me._birthDate
        End Get
        Set
            If _birthDate <> Value Then
                Me.OnBirthDateChanging(Value)
                Me.SendPropertyChanging()
                Me._birthDate = Value
                Me.SendPropertyChanged("BirthDate")
                Me.OnBirthDateChanged()
            End If
        End Set
    End Property

3. As per the above email, this doesn't execute properly.  What should 
instead be done is generating:

    If Not Nullable.Equals(_birthDate,Value) Then
        ...
    End If

Original issue reported on code.google.com by jonmpr...@gmail.com on 29 Apr 2010 at 3:07