Business Object Property


Author
Message
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Getting an "Invalid object name 'Companies'" exception seems to be coming back as an SqlException... its probably trying to access the database at design-time.

So, you can do one of 2 things...

1) Find where you're accessing the database during the get {} of that property and wrap it in an if(!this.DesignMode) {} block like this:

if (!this.DesignMode)
{
    // put your code here....
}

2) If you don't want to be able to set the value in the designer (meaning you don't care about telling your LocationsBO which CompaniesBO to use in the form designer), then add the following attributes to your property:

using System.ComponentModel;

...

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

Thse will prevent the form designer from evaluating the property and setting it in the .designer.cs file for your form.

Chan
Chan
Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Attached is the actual error message.
Chan
Chan
Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I defined a property as below. I get error from designer complaint that it is unable to serialize the code for this property. Any ideas?



public MyLibs.MyBO MyBusinessObject

{

get {return _myBO;}

set {_myBO = value;}

}




Any ideas?



Thank you
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search