Revers Mapping Wizard

2 posts, 0 answers
  1. Jonathan Simmons
    Jonathan Simmons avatar
    107 posts
    Member since:
    Jun 2005

    Posted 23 Jan 2009 Link to this post

    Hi, I am having problems with the reverse mapping wizard in that classes are not being properly created/updated.
    Here is the scenario.

    I start with a completely clean project and enable it for OpenAccess, then reverse engineer the NorthWindOA database.
    In the advanced tab of the wizard, I select the order reference in the Order Details table and tick the 'Create one-to-many list' checkbox, so that I can drill down through the Orders class to retrieve all the OrderDetails objects for the order. I then click the Generate & Save Config button to generate the classes.

    All works fine and when I create an Order object, I can see the OrderDetails collection.

    However, this does not work if I follow the procedure below instead.
    Start with a clean project, enable it for OpenAccess and reverse-engineer the NorthWindOA database as above. Now, if I click the Generate & Save Config button, all the classes are generated correctly. At this point, I re-open the Reverse Engineer Wizard at the advance tab, select the order reference in the Order Details table and tick the 'Create one-to-many' checkbox followed by Generate & Save Config.

    Now the Orders class is NOT properly updated. If I look at the code, in the file Order.Telerik.OpenAccess.cs, there is the line:

     

     
    private IList<OrderDetail> orderDetails = new List<OrderDetail>();  // inverse OrderDetail.order 
     
     
     

    and also the following is written in the #region main class file contents:

     /*[Telerik.OpenAccess.FieldAlias("orderDetails")]  
      public IList<OrderDetail> OrderDetails  
      {  
       get { return orderDetails; }  
      }
     */ 

    and this text is commented out.

    However, no public declaration of IList<OrderDetail> OrderDetails is written to the Order.cs class, so the collection of OrderDetails is never visible outside the class.

    The only way to make this work is to manually copy the commented-out text to the main Order.cs class. Surely this is not correct behaviour? We cannot be expected to know all the object relationships when reverse-engineering the database the first time, nor can we be expected to manually copy lines of code in a large schema when the tool should do the generation automatically.

    Perhaps I am missing something fundamental about reverse-engineering and class creation?

    Regards,
    Jonathan

     

  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 25 Jan 2009 Link to this post

    Hi Jonathan Simmons,
    This is Function as Designed. At the moment we do not touch the 'user' part of the code. If you restart the Reverse Engineering Wizard and regenerate the code we will only overwrite the *.OpenAccess.cs files/parts of your class.

    This behavior is implemented because we do not want to overwrite your code.

    Regards,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
Back to Top