471,348 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Business entity with additional properties

Hi all,

I'm designing classes for my application.

I'd like to create a business entity that could be expanded with other properties
when needed.

For example, this could be my entity:

MyBusinessClass
-> Property1
-> Property2
-> ...
-> OtherProperties

The "OtherProperties" property of the class could expose a name value collection
with the other properties associated to the entity.

Now, the question is:
can I use System.Configuration.SettingsProperty class to define the additional
property, and so declare the "OtherProperty" as SettingsPropertyCollection?

I mean: has someone used this before? Are this classes designed for this
purpose?

Thanks

Bye

Stefano
Feb 1 '06 #1
4 1495
Stefano,

You ^could^, but I don't think that this would be a good idea. The
reason for this is that every instance of your object (with each instance
representing separate entities) would share the same values, which is what I
am sure you don't want.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Stefano" <st*****************@giasoft.it> wrote in message
news:43*************************@msnews.microsoft. com...
Hi all,

I'm designing classes for my application.

I'd like to create a business entity that could be expanded with other
properties when needed.

For example, this could be my entity:

MyBusinessClass
-> Property1
-> Property2
-> ...
-> OtherProperties

The "OtherProperties" property of the class could expose a name value
collection with the other properties associated to the entity.

Now, the question is:
can I use System.Configuration.SettingsProperty class to define the
additional property, and so declare the "OtherProperty" as
SettingsPropertyCollection?

I mean: has someone used this before? Are this classes designed for this
purpose?

Thanks

Bye

Stefano

Feb 1 '06 #2
Hello Nicholas Paldino [.NET/C# MVP],
You ^could^, but I don't think that this would be a good idea.
The reason for this is that every instance of your object (with each
instance representing separate entities) would share the same values,
which is what I am sure you don't want.


I'm not sure that values will be shared.
Why did you say that?

I'm looking inside, using a reflector... that classes (SettingsProperty and
SettingsPropertyValue) doesn't have static members.

So, what is the correct use that we can do about this classes?

Thanks

Bye
Feb 1 '06 #3
Stefano,

It doesn't have static members, but the classes are meant to store
values that are used application-wide, not instance-wide.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Stefano" <st*****************@giasoft.it> wrote in message
news:43*************************@msnews.microsoft. com...
Hello Nicholas Paldino [.NET/C# MVP],
You ^could^, but I don't think that this would be a good idea.
The reason for this is that every instance of your object (with each
instance representing separate entities) would share the same values,
which is what I am sure you don't want.


I'm not sure that values will be shared.
Why did you say that?

I'm looking inside, using a reflector... that classes (SettingsProperty
and SettingsPropertyValue) doesn't have static members.

So, what is the correct use that we can do about this classes?

Thanks

Bye

Feb 1 '06 #4
Hello Nicholas Paldino [.NET/C# MVP],

thanks for the answer. You're right.

Anyway...

It could be great if the BCL had supplied a class that we could have used
in order to define a property, like the one that Vadym suggests:

public class CustomProperty
{
Name
PropertyType
Value
SerializedValue
....
}

Stefano,

It doesn't have static members, but the classes are meant to store
values that are used application-wide, not instance-wide.

"Stefano" <st*****************@giasoft.it> wrote in message
news:43*************************@msnews.microsoft. com...
Hello Nicholas Paldino [.NET/C# MVP],
You ^could^, but I don't think that this would be a good idea.
The reason for this is that every instance of your object (with each
instance representing separate entities) would share the same
values,
which is what I am sure you don't want.

I'm not sure that values will be shared.
Why did you say that?
I'm looking inside, using a reflector... that classes
(SettingsProperty and SettingsPropertyValue) doesn't have static
members.

So, what is the correct use that we can do about this classes?

Thanks

Bye


Feb 1 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Balaji | last post: by
1 post views Thread by Donal McWeeney | last post: by
6 posts views Thread by Abdullah Kauchali | last post: by
18 posts views Thread by Narshe | last post: by

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.