P
Pieter
Hi,
I've implemented some type of cache, to be able to point with multiple
references to the same object. Although, this 1-object-stuff is broken if I
do a refresh from the DataBase.
For instance I declare 2 objects:
dim MyA as clsCompany
dim MyB as clsCompany
And now I ask them from my factory:
'MyA: gets me the company with ID 1
MyA = MyFactory.GetCompanyWithID(1, enumFromCacheOrDataBase)
'MyB: Same thing, but because it's alreaddy in the ache, it returns me the
same object
MyB = MyFactory.GetCompanyWithID(1, enumFromCacheOrDataBase)
So it I change now a property of MyA, the same property will be changed in
MyB, because they poitn to the same object.
But: If I now explicitly do a refresh from the database, and replace the
object in the cache with the new one, I get something totally different:
MyB = MyFactory.GetCompanyWithID(1, enumFromDatabase)
If I change now a property of MyA, it won't be changed in MyB: they are
linked to 2 different objects now! What can I do to have them always being
linked to the same object? If I refresh one, all the others must point to
the new object...
Any help our hitns will be really appreciated!
Thansk a lot in advance,
Pieter
I've implemented some type of cache, to be able to point with multiple
references to the same object. Although, this 1-object-stuff is broken if I
do a refresh from the DataBase.
For instance I declare 2 objects:
dim MyA as clsCompany
dim MyB as clsCompany
And now I ask them from my factory:
'MyA: gets me the company with ID 1
MyA = MyFactory.GetCompanyWithID(1, enumFromCacheOrDataBase)
'MyB: Same thing, but because it's alreaddy in the ache, it returns me the
same object
MyB = MyFactory.GetCompanyWithID(1, enumFromCacheOrDataBase)
So it I change now a property of MyA, the same property will be changed in
MyB, because they poitn to the same object.
But: If I now explicitly do a refresh from the database, and replace the
object in the cache with the new one, I get something totally different:
MyB = MyFactory.GetCompanyWithID(1, enumFromDatabase)
If I change now a property of MyA, it won't be changed in MyB: they are
linked to 2 different objects now! What can I do to have them always being
linked to the same object? If I refresh one, all the others must point to
the new object...
Any help our hitns will be really appreciated!
Thansk a lot in advance,
Pieter