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

Reverse mapping bug

5 Answers 95 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.
dmajkic
Top achievements
Rank 2
dmajkic asked on 16 Jan 2009, 09:01 PM
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. 


5 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 19 Jan 2009, 09:42 AM
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.
0
tmlipinski
Top achievements
Rank 1
answered on 23 Feb 2009, 11:43 AM
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
0
dmajkic
Top achievements
Rank 2
answered on 23 Feb 2009, 12:41 PM
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.
0
Alexander
Telerik team
answered on 23 Feb 2009, 01:22 PM
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.
0
tmlipinski
Top achievements
Rank 1
answered on 23 Feb 2009, 01:33 PM
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
Tags
Design Time (Visual Designer & Tools)
Asked by
dmajkic
Top achievements
Rank 2
Answers by
Alexander
Telerik team
tmlipinski
Top achievements
Rank 1
dmajkic
Top achievements
Rank 2
Share this question
or