Linking classes

asp.net Netherlands
  • 13 years ago

    Hi,

    I have a windows-application of which I want to use components to build a web-based application.  One of my key questions at the moment is how to deal with the data.  There are various classes and for each class there is a collection.  Some of the properties refer to other classes/collections.

    I'll give a simplified example below, using some standard/common objects to avoid having to explain the underlying meaning of my data-objects:

    Class SalesPerson with properties like SalesPersonID, and Name.
    Class Order with properties like OrderID, SalesPersonID, Amount, and WhoDidIt.

    The property WhoDidIt in the Order-class is effectively a read-only property of the type SalesPerson, that creates a reference to the specific SalesPerson-'record' in the oSalesPersons collection using the SalesPersonID.  It allows you to do something like

    dAmount = oOrder.Item(1).Amount
    sName = oOrder.Item(1).WhoDidIt.Name

    Which is very handy in For-Next loops, etc. as it keeps the code nice and tidy.

    When creating the reference, the code refers to the populated collection.  In the Windows-application this is a public variable (e.g. oSalesPersons) defined in the main-form.  So it's easy to refer to: frmMain.oSalesPersons.

    Now the big question: ow to do this in an ASP.Net environment ?  Where do I save / initiate the populated collections so that I can refer to them in my data-structure ?

    Thanks for your help !

    Erwin

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou