Jeff-Lewis / codesmith

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

Nullable Column Associated with Enum Not Marked as Nullable #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create table with nullable column with foreign key relationship to 
table that will be generated as an enum.
2. Generate code.
3. Review generated entity's column mapped properties. 

What is the expected output? 
  public Nullable<RoleType> UnionRoleTypeId

What do you see instead?
  public RoleType UnionRoleTypeId

What version of the product are you using?
v.2.1.655

Please provide any additional information below.

Feel free to contact me if you have any questions.

Original issue reported on code.google.com by tyler.je...@gmail.com on 12 Apr 2009 at 6:34

GoogleCodeExporter commented 9 years ago
Confirmed this to be a bug.  We'll work on a fix for a future release.

Original comment by paul.wel...@gmail.com on 21 Apr 2009 at 2:30

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 21 Apr 2009 at 3:57

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 21 Apr 2009 at 4:14

GoogleCodeExporter commented 9 years ago
fixed in the latest build of plinqo

Original comment by paul.wel...@gmail.com on 21 Apr 2009 at 9:20

GoogleCodeExporter commented 9 years ago
Using the 2.1.667 build, the enum is made nullable but the On<entity>Changing 
param 
is not getting the nullable, so it generates a 

"The best overloaded method match for '...On<entity>Changing(<type>)' has some 
invalid arguments..."

sample code:

public Nullable<PartyType> PartyTypeId
{
    get { return _partyTypeId; }
    set
    {
        if (_partyTypeId != value)
        {
            OnPartyTypeIdChanging(value);
            SendPropertyChanging("PartyTypeId");
            _partyTypeId = value;
            SendPropertyChanged("PartyTypeId");
            OnPartyTypeIdChanged();
        }
    }
}

...

   partial void OnPartyTypeIdChanging(PartyType value);

which should be

   partial void OnPartyTypeIdChanging(Nullable<PartyType> value);

I think...

In addition, I am still getting the type conversion error on code like this:

public PractitionerPerson PractitionerPerson
{
    get { return (serializing && !_practitionerPerson.HasLo
    set
    {
        PractitionerPerson previousValue = _practitionerPer
        if (previousValue != value || _practitionerPerson.H
        {
            SendPropertyChanging("PractitionerPerson");
            if (previousValue != null)
            {
                _practitionerPerson.Entity = null;
                previousValue.PractitionerSpecialtyList.Rem
            }
            _practitionerPerson.Entity = value;
            if (value != null)
            {
                value.PractitionerSpecialtyList.Add(this);
                _personId = value.PersonId;
                _roleTypeId = value.RoleTypeId;
            }
            else
            {
                _personId = default(long);
                _roleTypeId = default(RoleType);
            }
            SendPropertyChanged("PractitionerPerson");
        }
    }
}

specific error lines are:

   _roleTypeId = value.RoleTypeId;

   _roleTypeId = default(RoleType);

where those lines have to be:

   _roleTypeId = (long)value.RoleTypeId;

   _roleTypeId = (long)default(RoleType);

(Yeah, I'm the idiot using BIGINT for enum ID values. :) )

Original comment by tyler.je...@gmail.com on 22 Apr 2009 at 6:27