NameValueLists each copy from different databases

NameValueLists each copy from different databases

Old forum URL: forums.lhotka.net/forums/t/5363.aspx


BillArms posted on Monday, September 08, 2008

My scenario is this.  I have a web-based application which displays a set of Crystals reports against different databases.  Each of theses reports has 0 to 3 parameter tuples which are eithers a range, an upper limit or a lower limit.  The user will select the database, then the report and finally the parameters. The user interface needs to supply a single selectable list for the parameter tuple.  I opted to uses CSLA NVLs to populates the list-boxes for the parameters.  I will persist the NVL BOs in a session variable, unique to that report and database.

It is my intent to supply the database connection string as a parameter to the GetXxxxNVL factory method. I will wrap that string into the Criteria object and when I use the Dataportal_Fetch, I will use the connection string to set the the database.

My question is "Am I missing something?" I believe that by adding the database conn info to the Criteria the NVL caching will see each instance as unique.  Did I miss something else that may be cache the data and return the wrong dtat for the database?

Best Regards,
Bill

Michael Hildner replied on Wednesday, September 10, 2008

Hope I understand you correctly. If things are set up the way the books describe, once you populate the NVL, the NVL will return that list - so it doesn't have to fetch from the database every time. You can always call the InvalidateCache() method to clear the list which will force a re-fetch from the DB.

Regards,

Mike

BillArms replied on Monday, September 15, 2008

Thanks for the reply Mike.

I agree with what you say.

I think, if I am reading the code correctly, that the differing criteria result in multiple caches each of which should be returned when asked for with a unique set of criteria.

Is that your understanding?

Regards,
Bill


Michael Hildner replied on Monday, September 15, 2008

I'm not sure what code you're reading. My NVL's only have one list object - that's what gets cached. If it's null it gets populated by whatever criteria. So if I need to re-fetch the NVL, I'll call the InvalidateCache() method first which sets the list to null, then fetch.

BillArms replied on Monday, September 15, 2008

Mike,

I looked at the NVL code again and found that I was wrong.  There is only one cache not multiples.

Thank you for your insight,
Bill

Copyright (c) Marimer LLC