views:

12

answers:

0

Hi,

I have a usercontrol “DataDesigner” that is more or less like an DataSet Designer. In this Control I define the Database Structure in my own classes. Ever Form has a FormDescriptor, each FormDescriptor can have multiple TableDescriptor and each TableDescriptor can have multiple FieldDescriptor. All of this classes have a lot of properties that can be edited by the DataDesigner. Ones all the Properties have been set the structure is Serialized into the InitializeComponent of the Form. All of this works great. Now I am busy change the software, to be multilingual. And this is where the problem comes in. Normally my Code gets generate as follows.

My.FormDescriptor formDescriptor1 = new My.FormDescriptor("frmTestForm");
My.TableDescriptor tableDescriptor1 = new My.TableDescriptor("User");
My.FieldDescriptor fieldDescriptor1 = new My.FieldDescriptor("Name");
My.FieldDescriptor fieldDescriptor2 = new My.FieldDescriptor("Surname");
My.FieldDescriptor fieldDescriptor3 = new My.FieldDescriptor("DOB");

….

I can change what I want (Form Properties and/or DataDesigner Properties), as long as I don’t change the Language in my Form Designer my Code always gets create like that. Now as soon as I change the Language in the Designer (so that I can edit my localized properties in the selected language) the CodeDomSerializer Serializes the code as follows.

My.FormDescriptor formDescriptor2 = new My.FormDescriptor("frmTestForm");
My.TableDescriptor tableDescriptor2 = new My.TableDescriptor("User");
My.FieldDescriptor fieldDescriptor4 = new My.FieldDescriptor("Name");
My.FieldDescriptor fieldDescriptor5 = new My.FieldDescriptor("Surname");
My.FieldDescriptor fieldDescriptor6 = new My.FieldDescriptor("DOB");

…. The Problem is because of the new “Instance” I lose my Translation in my Resourcefiles.

If I now Open the DataDesigner and edit a Property, the Code gets Serialized as follows again.

My.FormDescriptor formDescriptor1 = new My.FormDescriptor("frmTestForm");
My.TableDescriptor tableDescriptor1 = new My.TableDescriptor("User");
My.FieldDescriptor fieldDescriptor1 = new My.FieldDescriptor("Name");
My.FieldDescriptor fieldDescriptor2 = new My.FieldDescriptor("Surname");
My.FieldDescriptor fieldDescriptor3 = new My.FieldDescriptor("DOB");

….

So the Behavior is only when I change the Language, I get the new Instance of my classes. After that it does not matter in what Language I am my Code gets create normally. Does anyone have an Idea why this is happening?