This is a migrated thread and some comments may be shown as answers.

Reverse mapping, adding new fields

4 Answers 73 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert Lautenbach
Top achievements
Rank 1
Robert Lautenbach asked on 12 May 2010, 06:03 PM
I've been using reverse mapping as I develop a new system. During development I have been adding fields to tables and running merges to get the new data in my persisted objects. I noticed pretty quickly that the merge routine does not touch the top level generated partial class files.

Is there any way to force generation of a top level partial class file? Is there anywhere in the reverse mapping tool I can go to copy the new top level partial class property code?

I completely understand leaving this file untouched to avoid disrupting any custom changes/additions. It makes perfect sense. But there has to be some way to insert new field properties into these files as new fields are merged in. 

It's frustrating to run a merge and then have to go into individual class files and add properties. Whenever I add a few fields of varying data types, including foreign key fields that end up as lists, I have to hand code a bunch of properties that I don't otherwise customize. This should be automated somehow or at the very least there should be somewhere I can go to copy the new code and paste it into my partial classes.

Thanks!

4 Answers, 1 is accepted

Sort by
0
Robert Lautenbach
Top achievements
Rank 1
answered on 12 May 2010, 06:10 PM
Just to clarify a bit on my one requested solution --

When I view "Source Code and Mapping for the complete class" in the Reverse Mapping window I see the private variable declarations and the xml mapping info. Having a similar panel to copy the public property declarations would be a big help. That said, some kind of automation for the public properties would be ideal.


0
PetarP
Telerik team
answered on 13 May 2010, 08:09 AM
Hello Robert Lautenbach,

The behavior you are observing is actually by design. The Reverse mapping wizard by default generates two partial classes for each of your tables. One is [name of class].cs that holds the properties definitions and one is [name of class].Telerik.OpenAccess.cs that holds the private fields definitions. During regeneration of the classes only the one holding the private fields gets regenerated. This is done because by default we assume that the user might have some custom code implemented in his properties and we are intentionally not overriding it. If you look at the end of the file that contains your private fields you will find the code for the all the properties as commented out. You can manually copy it over your property class if you don't have any property logic that you will erase. In order to avoid the manual copy you should disable the generation of partial classes. This will result in generating your fields and properties in one and the same file, thus overriding it with the complete definition after each merge. In order to turn the partial generation off you sholud follow the steps provided in this topic.

Kind regards,
Petar
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.
0
Robert Lautenbach
Top achievements
Rank 1
answered on 13 May 2010, 02:48 PM
I don't seem to have the commented out public properties in my partial class with the private properties. I am running the 2010 Q1 release.
0
Accepted
PetarP
Telerik team
answered on 17 May 2010, 05:00 PM
Hello Robert Lautenbach,

The commented code is available only for C#. If you are using VB.NET I am afraid that you won't be able to take advantage of that feature and the only way for you not to do anything by hand would be to disable the partial class generation.
I am sorry for any inconvenience caused.

Regards,
Petar
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.
Tags
Design Time (Visual Designer & Tools)
Asked by
Robert Lautenbach
Top achievements
Rank 1
Answers by
Robert Lautenbach
Top achievements
Rank 1
PetarP
Telerik team
Share this question
or