473,326 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Persistence Problem...

PJ
Greetings,

I ran into a slight problem. Let's say we have two classes like
below:

---- START CODE ----
class foo
{
private string __Text;
private Unit __Unit;

public foo()
{
}

public string Text
{
get { return __Text; }
set { __Text = value; }
}

public Unit Width
{
get { return __Unit; }
set { __Unit = value; }
}
}

class bar : WebControl
{
private foo __Property1;
private foo __Property2;

public bar()
{
__Property1 = new foo();
__Property1.Text = "Default Value 1";
__Properyt1.Unit = new Unit(10, Pixel);

__Property2 = new foo();
__Property2.Text = "Default Value 2";
__Properyt2.Unit = new Unit(100, Pixel);
}

public foo Property1
{
get { return __Property1; }
set { __Property1 = value; }
}

public foo Property2
{
get { return __Property2; }
set { __Property2 = value; }
}
}

---- END CODE ----

The class 'foo' has only two properties: 'Text' and 'Width', strongly
typed and all. The class 'bar' has another two properties:
'Property1'
and 'Property2', both of them are of type 'foo'.

The problem is: How can I set the property attributes of 'Property1'
and 'Property2' of the class 'bar' in a way that the default values
specified on the 'bar' constructor doesn't get persisted.

As is the persistence of the class bar (for the default values --
let's make it perfectly clear) is something like:

---- START CODE ----

<cc1:bar ID="bar1" runat="server">
<Property1 Text="Default Value 1" Width="10px">
<Property2 Text="Default Value 2" Width="100px">
</cc1:bar>

---- END CODE ----

What I want is that with only the DEFAULT values of each property the
object to be persisted as:

---- START CODE ----

<cc1:bar ID="bar1" runat="server" />

---- END CODE ----

How can I do this with only attributes?

Regards,

PJ
http://pjondevelopment.50webs.com

Sep 11 '07 #1
0 885

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paolo Losi | last post by:
Hi all, I'm pretty new to the python language so please excuse me if this is FAQ... I'm very glad to be part of the list! :-) I'm looking into a way to implement a generic workflow framework...
2
by: ryankaskel | last post by:
I don't know if this is the appropriate place to post a Zope question but I figure many here are familiar with it. I'm confused about the role of the ZMI when it comes to development. I want to...
1
by: Joe | last post by:
I was wondering if there are any recommended persistence frameworks for use in .NET that could be recommended. I am looking for the following requirements: Free/Open Source or very inexpensive....
10
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in...
2
by: dkode | last post by:
Hello, I am laying out the architecture for a very large website that will scale to a very large degree. I have a couple of questions before I attempt to go and implement a Broker/Persistence...
5
by: Chris Spencer | last post by:
Before I get too carried away with something that's probably unnecessary, please allow me to throw around some ideas. I've been looking for a method of transparent, scalable, and human-readable...
13
by: Peter Morris [Droopy eyes software] | last post by:
Hi all Any recommendations for a good object persistence framework? I'd be interested in hearing from anyone with personal experience. Thanks Pete
1
by: Mike Howarth | last post by:
I've been having a few problems with connecting to SQL Server, initially I was using dblib however found some problems with returning text fields whereby all text fields were ignored and it bawked...
0
myusernotyours
by: myusernotyours | last post by:
Hi all, Am trying to create a Java Desktop App that uses Java Persistence in Netbeans. The database is MS Access but I tried with Mysql and got the same error. When I run the app( Create the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.