Caching issue with my custom datatype? Options
simm2
Posted: Saturday, December 29, 2007 5:19:28 PM
Rank: Enthusiast

Joined: 12/22/2007
Posts: 12
I'm having some troubles with my custom datatype. It is solely a backend module which deals with converting an Excel-spreadsheet to SQL fields

The problem occurs when I have deleted an item in the Media-section and replaced it with another, then my custom datatype picks up the old nodeid instead of the new one. Since the old one does not exist an exception is thrown

I believe it has something to do with Umbraco and the way it caches content?
If so, how do I get my custom datatype to pick up the changes?

TIA

Simon
tim
Posted: Sunday, December 30, 2007 5:03:31 PM

Rank: Addict

Joined: 2/19/2007
Posts: 738
Location: Belgium
Hi,

could you show the code you are using ? and why do you use the media item ? For storing the excell ?

Greets,
Tim

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
simm2
Posted: Sunday, December 30, 2007 9:24:32 PM
Rank: Enthusiast

Joined: 12/22/2007
Posts: 12
Hi Tim,

Yes I use the media library for organising pictures, excel-files and such. When the customer references the excel-file with a media picker it is stored in the SQL database. A little cumbersome solution, but I thought that was the most userfriendly.

Code:

int currentnode = int.Parse(System.Web.HttpContext.Current.Request.QueryString["id"]);

umbraco.presentation.nodeFactory.Node n = new umbraco.presentation.nodeFactory.Node(currentnode);
             
int mediaid = Convert.ToInt32(n.GetProperty("selectPricelist").Value);
umbraco.cms.businesslogic.media.Media m = new umbraco.cms.businesslogic.media.Media(mediaid);
string pathtoMedia = (string)m.getProperty("umbracoFile").Value;


If I delete a node in the media library, it doesn't seem like the cache is updated, because if I pick a new node and publish the page, Umbraco points me to the old deleted node

so I somehow think I need to force an update to get things working or something, maybe you can point me in the right direction

Thanks
Simon :)
tim
Posted: Monday, December 31, 2007 9:34:51 AM

Rank: Addict

Joined: 2/19/2007
Posts: 738
Location: Belgium
wierd problem

try adding

content.Instance.RefreshContentFromDatabaseAsync();

Or if it fails maybe it is saver to upload the file as a property of your content and not in the the media ...

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
simm2
Posted: Monday, December 31, 2007 12:45:17 PM
Rank: Enthusiast

Joined: 12/22/2007
Posts: 12
Hi Tim,

Thanks for your help, however it did not work out. Then I must make it a property of my content as you suggested. I'll try that.

Happy New Year!
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.