Object identity changes while implementing restriction method?!

From: Julia (NoOne_at_Home.com)
Date: 04/30/04


Date: Fri, 30 Apr 2004 13:11:44 +0200


Hi,

I am in process of writing an object model which being persisted into a
relational data base
and I want to add a RESTRICTION method which return a sub collection of
objects

for example,assuming I have the following table:

PERSONS

And the following class:

class Person
{
  Public Property Get Parent() as Persons 'Weak reference to the parent
collection
}

And hopefully the ability to write something like this:

Dim Persons as Persons
Dim Childrens as Persons
Dim Person as Person

Set Persons=Application.Persons 'All persons
Set Childrens=Persons.Restrict("age<18") ' Subset of persons

as far as I understand,since the Person object support the 'Parent' property
it's identity
compose of a row identity and the 'context'(the parent) in which it was
created.
In such case I need to hold more that one object for the same row?!

What is the solution for such a problem?

Assuming I agree to hold several objects for a row, is it good idea to make
all in memory objects
(which represent the same row) up to date?
meaning if one object state is change should I change all other object state
as well?

In such way i can preserve the correctness of a row representation *
(if one object saved to a data base other will reflects the current row
state as well, without the need
of reloading the row)
While keeping the difference of the context(the parant) for each object.

Thanks,

* assuming no changes to fields made by external process(calculated,trigger
etc...)



Relevant Pages

  • Re: Object identity changes while implementing restriction method?!
    ... > Public Property Get Parent() as Persons 'Weak reference to the parent ... > Dim Childrens as Persons ... > (if one object saved to a data base other will reflects the current row ... Making the Restrict method understand criteria like "Age<18" is the harder ...
    (comp.object)
  • RE: Parse Nested Elements to Single DataGrid
    ... 'Dim MasterTable As New DataTable ... Dim TableName, TableNameInner As String ... 'Save the next and last row values for this parent ... 'Get LoopRowNum for table where TableName is the key ...
    (microsoft.public.dotnet.xml)
  • RE: Re-run a Query Based on Previous Results
    ... Function fnProgenitor(Fsbill As String, ... Dim rs As DAO.Recordset ... The value for ID is the first Parent in Fsbill. ...
    (microsoft.public.access.queries)
  • RE: Re-run a Query Based on Previous Results
    ... Public Function fnProgenitor(TableName as String, ... Dim rs As DAO.Recordset ... Dim varParentID As Variant ... I have a function I use to determine the ROOT LEVEL parent (the ...
    (microsoft.public.access.queries)
  • Re: parent column in child row
    ... You can do what you want by adding a calculated column to the child ... DataTable that contains and expression that references a parent row column. ... Dim cn As SqlConnection = New SqlConnection ...
    (microsoft.public.dotnet.framework.adonet)