NVL's not Refreshing

NVL's not Refreshing

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


Sarosh posted on Monday, June 25, 2007

Hi!

I am currently using CSLA 2.14

I have a DataGridView (in a Winform) with a few ComboBox Columns each bound to a BindingSource which in turn is bound to a NVL BO. In the Form's Load event I have call the RefreshLookups() method on the form which loads all the date from lookup

private void RefreshLookups()

{

this.ScheduleNVL = ScheduleNVL.GetScheduleNVL();

this.schedulebindingSource.DataSource = this.ScheduleNVL;

this.DesignAreaNVL = DesignAreaNVL.GetDesignAreaNVL();

this.designAreabindingSource.DataSource = this._DesignAreaNVL;

this.LoadTypeNVL = LoadTypeNVL.GetLoadTypeNVL();

this.loadTypebindingSource.DataSource = this._LoadTypeNVL;

}

All the ComboBox Columns show the correct values from their respective BO's/Lookup tables, while this main form is open the same user can open one or more lookup maintenance forms and add new rows, change descriptions etc. After saving these changes in the lookup forms when they activate the main form the DropDown Combo's don't show the changes which I guess is normal but they can click on a refresh button on the main form which calls the RefreshLookups() method but even after that the DropDown's don't get the new/changed values.

When I look at the NVL BO's even they are not getting the new values so I guess there is some caching going on some where and I am not sure how to refresh the BO's.

Thanks

Sarosh

dcleven replied on Monday, June 25, 2007

If the NVL BO do not have the new values then you must be using a cached NVL. Check the NVL GetList() method to see if it is checking for a cached list member and avoiding the creation of a new list.

--Doug

Sarosh replied on Monday, June 25, 2007

Hi!

How do I check that?

Is there a property on the NVL BO to specify whether or not you want caching?

I am using the default CSLA NVL Objects.

Sarosh

dcleven replied on Monday, June 25, 2007

Just look at the source code for your GetList() method which you have to implement, it is not part of the CSLA, but a pattern that many use when implementing the derived NVL class.

Here is an example that implements the caching pattern.

public static MyList GetList()

{

   if (m_cachedList == null)

   {

         m_cachedList = DataPortal.Fetch<MyList>(new Criteria());

   }

   return m_cachedList;

}

 

Sarosh replied on Monday, June 25, 2007

Hi!

You were right on the money!

I did generate my BO's using templates and did not realise that they were being cached.

Thanks a lot for your help.

Sarosh

 

Copyright (c) Marimer LLC