Reverse mapping, field length inconsistent

2 posts, 0 answers
  1. Robert Lautenbach
    Robert Lautenbach avatar
    18 posts
    Member since:
    Dec 2009

    Posted 14 May 2010 Link to this post

    I've noticed that changing field lengths on foreign key varchar or char fields produces some unexpected results. I started off with a field that was 50 characters. I changed to 10 characters and ran a reverse update merge.

    As you can see here, the configuration settings show 10 for the fk id field (the first one) and 50 for the lookup field.

                <field name="_lookupCriteriaOperatorCode">
                  <extension key="db-column">
                    <extension key="db-type" value="VARCHAR" />
                    <extension key="db-column-name" value="lookup_criteria_operator_code" />
                    <extension key="db-length" value="10" />
                  </extension>
                </field>
                <field name="_lookupCriteriaOperator">
                  <extension key="db-column">
                    <extension key="db-type" value="VARCHAR" />
                    <extension key="db-column-name" value="lookup_criteria_operator_code" />
                    <extension key="db-length" value="50" />
                  </extension>
                </field>

    The only way to correct this was to go back and manually edit the incorrect xml. This seems like a bug. It can be dangerous on char/varchar fields because it causes string truncation when the value is lower than it should be.


  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 19 May 2010 Link to this post

    Hi Robert Lautenbach,

     I assume you are using MS SqlServer. I did try to reproduce the problem by starting of with a FK constraint on an varchar(50) column. I generated the classes and mapping and then modified the length of the FK column to 20. The database enforces this length on the referenced PK column also.
    If I now do a 'Merge' using the wizard, the reference field mapping needs to be done again. We will look into this. But once the reference field is mapped again and the class is regenerated, I get the same column length for both the fields. So in short, I could not generate the same mapping ambiguity that you posted.

    Can you provide the exact steps you did to reproduce the problem?

    Sincerely yours,
    Ady
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
Back to Top