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