Developer forum

Forum » Development » Linq query for page-item not working before App-pool restart

Linq query for page-item not working before App-pool restart

Jonas Mersholm
Reply

Hi there,

I'm currently testing a script meant to fetch some pages based on a mix of general page-class properties, and page-item values. The query works fine, but if a pageitem value is updated, it is not registered before an app-pool recycle has been performed. It's like the values are cached, and not caught by the query. Any idea's or solutions would be greatly appreciated.

 

            var Campaign = Dynamicweb.Extensibility.ServiceLocator.Current.GetPageService().GetPagesByAreaID(1306).Where(x =>
                   x.Active &&
                   x.ActiveFrom <= DateTime.Now &&
                   x.ActiveTo > DateTime.Now &&
                        (
                            Convert.ToBoolean(x.Item["AlleM_glere"].ToString()) == true ||
                            x.Item["ValgteM_glere"].ToString().Split(',').Contains(BrokerID.ToString())
                        ) &&
                  Convert.ToDateTime(x.Item["LaasFra"].ToString()) <= DateTime.Now &&
                  Convert.ToDateTime(x.Item["LaasTil"].ToString()) >= DateTime.Now
                   );


Replies

 
Martin Vang
Reply

Hi Jonas,

We're currently working on improving the way areas, pages, paragraphs and items are fetched - both from memory (cached, fast) and from database (non-cache, slow).

The method you use (GetPagesByAreaID) is currently non-cached, while the Items are cached, so your description sounds plausible.

Can I get you to describe / record what you do to provoke the bug, so I can test it?

BR

Martin

 

 
Jonas Mersholm
Reply

Hi Martin,

Can i e-mail you a video somehow? 

Best,

Jonas

 
Martin Vang
Reply

Hi Jonas,

I'd perfer the forum thread to be as informative for others as possible. Can I get you to use a shared screencast video instead? Fx https://www.techsmith.com/download/jing/

BR

Martin

 
Jonas Mersholm
Reply

Hi Martin,

 

There is a screencast here: https://www.screencast.com/t/hT2RqvgaqWpJ     - Let me know if you need any more info, :-)

 

Best,

Jonas

 
Martin Vang
Reply

Hi Jonas,

Can you tell me what you get from "GetPagesByAreaId(1306)", both before and after the reset? It should be the same.

Also, while I appriciate that Linq is nice and all, could you try to step through the program and see which of your page properties does not match what you expect (ei. rewrite to a foreach and use breakpoints to look at the data)? :)

Also, can you tell me which version of dynamicweb you're running?

BR

Martin

 

You must be logged in to post in the forum