Business entity with additional properties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stefano

    #1

    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 "OtherPropertie s" 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.Configur ation.SettingsP roperty class to define the additional
    property, and so declare the "OtherPrope rty" as SettingsPropert yCollection?

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

    Thanks

    Bye

    Stefano


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Business entity with additional properties

    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]
    - mvp@spam.guard. caspershouse.co m

    "Stefano" <stefano_REMOVE THIS_@giasoft.i t> wrote in message
    news:4343d25b3e a18c7f55ddf6298 83@msnews.micro soft.com...[color=blue]
    > 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 "OtherPropertie s" 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.Configur ation.SettingsP roperty class to define the
    > additional property, and so declare the "OtherPrope rty" as
    > SettingsPropert yCollection?
    >
    > I mean: has someone used this before? Are this classes designed for this
    > purpose?
    >
    > Thanks
    >
    > Bye
    >
    > Stefano
    >
    >[/color]


    Comment

    • Stefano

      #3
      Re: Business entity with additional properties

      Hello Nicholas Paldino [.NET/C# MVP],
      [color=blue]
      > 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.[/color]

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

      I'm looking inside, using a reflector... that classes (SettingsProper ty and
      SettingsPropert yValue) doesn't have static members.

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

      Thanks

      Bye


      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: Business entity with additional properties

        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]
        - mvp@spam.guard. caspershouse.co m

        "Stefano" <stefano_REMOVE THIS_@giasoft.i t> wrote in message
        news:4343d25b4d f68c7f56d1e9df1 03@msnews.micro soft.com...[color=blue]
        > Hello Nicholas Paldino [.NET/C# MVP],
        >[color=green]
        >> 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.[/color]
        >
        > I'm not sure that values will be shared.
        > Why did you say that?
        >
        > I'm looking inside, using a reflector... that classes (SettingsProper ty
        > and SettingsPropert yValue) doesn't have static members.
        >
        > So, what is the correct use that we can do about this classes?
        >
        > Thanks
        >
        > Bye
        >
        >[/color]


        Comment

        • Stefano

          #5
          Re: Business entity with additional properties

          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
          ....
          }

          [color=blue]
          > Stefano,
          >
          > It doesn't have static members, but the classes are meant to store
          > values that are used application-wide, not instance-wide.
          >
          > "Stefano" <stefano_REMOVE THIS_@giasoft.i t> wrote in message
          > news:4343d25b4d f68c7f56d1e9df1 03@msnews.micro soft.com...
          >[color=green]
          >> Hello Nicholas Paldino [.NET/C# MVP],
          >>[color=darkred]
          >>> 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.[/color]
          >> I'm not sure that values will be shared.
          >> Why did you say that?
          >> I'm looking inside, using a reflector... that classes
          >> (SettingsProper ty and SettingsPropert yValue) doesn't have static
          >> members.
          >>
          >> So, what is the correct use that we can do about this classes?
          >>
          >> Thanks
          >>
          >> Bye
          >>[/color][/color]



          Comment

          Working...