Reverse mapping bug

6 posts, 0 answers
  1. dmajkic
    dmajkic avatar
    7 posts
    Member since:
    Mar 2007

    Posted 16 Jan 2009 Link to this post

    There is a bug with reverse mapping.

    In reverse mapping wizard, I renamed class to singular form (eg: from Partneri  to  Partner) and then I clicked on Gen & Save.
    Classes are generated, but it can't be compiled.

    Problem is that for every table two files are created,  and second file (Dokument.Telerik.OpenAccess.cs) contains declarations with old,  plural,  names. Something like

    ... 
     private Partneri partneri; 
    ... 







    This will not compile. Partneri should be Partner. 

    And Dokument.cs contains this

          [Telerik.OpenAccess.FieldAlias("partneri")] 
            public Partner Partneri 
            { 
                get { return partneri; } 
                set { this.partneri = value; } 
            } 

    This will compile, but property is generated in plural form. Since it is FK declaration, It should be singular (Partner) on Document.

    And so on for every generated file that I renamed class name. 


  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 19 Jan 2009 Link to this post

    Hi dmajkic,

    I did not succeed in reproducing the behavior you described. Could you please, send us a support ticket with a sample project/database attached so we will be able to evaluate the exact problem locally.

    Best wishes,
    Alexander
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. tmlipinski
    tmlipinski avatar
    131 posts
    Member since:
    Dec 2006

    Posted 23 Feb 2009 Link to this post

    Hi,
    Revers mapping creates two files:
    <class name>.cs
    <class name>.Telerik.OpenAccess.cs

    My experiments say that when updating class definitions (after changing the database structure) only the second file is recreated and the first remains unchanged. The workaround is:
    - don't add any code to <class name>.cs (if required, create one more file (sth like <class name>.Extensions.cs) with "public partial class <class name>")
    - delete <class name>.cs (together with the second file) to force creating them from scratch

    It works. But I'm not sure if it is the intended behaviour...?

    Regards
    Tomasz
  5. dmajkic
    dmajkic avatar
    7 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2009 Link to this post

    Hi.

    I just want to note that I have no problems with newest version. I mapped all tables, set one to many and and many to many relationships, and all classes get generated and build with no errors. As expected.   

    I must say that so far Telerik ORM it is a great time saver.  All classes are very simple and, beside attribute decorations,  they are very close to simple manual data abstraction I was using before. Now, with fine settings in config file and included db access abstraction and forward and reverse mapping wizard, data part development it is a lot faster.

    I'm moving beyond mapping - to actual data usage. And I will report here all issues I find.

    Best regards.
  6. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 23 Feb 2009 Link to this post

    Hello tmlipinski,

    OpenAccess does not change the .cs file in order not to overwrite any code that the programmer may have written there. However the newly generated code could be found in the other .Telerik.OpenAccess.cs file in a commented block.

    Greetings,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. tmlipinski
    tmlipinski avatar
    131 posts
    Member since:
    Dec 2006

    Posted 23 Feb 2009 Link to this post

    Hi,

    OK. But as for me - it should be another option: today's behaviour OR recreating <class name>.cs file (and NOT including commented code into <class name>.Telerik.OpenAccess.cs file...). 

    Regards
    Tomasz
Back to Top
DevCraft banner