Yet More Bizarre Behavior -- Inconsistent Property Deserialization

Yet More Bizarre Behavior -- Inconsistent Property Deserialization

Post by Mark Olber » Mon, 05 Apr 2004 08:21:55


Could someone please explain to me why InitializeComponent() code like the following:

//
// giver_rec
//
this.Controls.Add(this.dbFrameworkTextBox1);
this.Controls.Add(this.tbxAddress);
this.Controls.Add(this.tbxGiverName);
this.Name = "giver_rec";
this.SqlDataPackageType = typeof(Test.Component2);
this.TableName = "giver";

and properties defined as follows (for the class being initialized):

[
Category("SqlDataPackage"),
Editor(typeof(TableUIEditor), typeof(UITypeEditor)),
]
public string TableName
{
get { return tblName; }
set { tblName = value; }
}

[
Category("SqlDataPackage"),
Editor(typeof(SqlDataPackageUIEditor), typeof(UITypeEditor)),
]
public Type SqlDataPackageType
{
get { return dataPkgType; }
set { dataPkgType = value; }
}

Results in ONLY the SqlDataPackageType property being set when the component comes up in the
VSIDE???? I can watch SqlDataPackageType_set being called in the de *** , but the corresponding
TableName_set method NEVER gets called!

Does the component initialization process dislike strings or something????? :)

BTW, since Microsoft apparently firmly believes that custom component design shouldn't be
documented, does anyone have any 3rd party books they can recommend on Windows.Forms custom
control/component development?

- Mark
 
 
 

Yet More Bizarre Behavior -- Inconsistent Property Deserialization

Post by Mark Olber » Mon, 05 Apr 2004 10:47:40

Followup -- I figured out what was causing the oddball behavior. It turns out I had an interface
definition on that class which included a TableName_get() method, but not a TableName_set() method.
I was updating the property (from within a UITypeEditor) using the interface, so there was no _set()
method.

Note to file:

public string TableName
{
get;
set;
}

and

string ISomeInterface.TableName
{
get;
}

are two totally different beasts.

- Mark