might be of interest... I refactor the sql script for selecting the prevalue so that it isn't a database call and for our needs added in the pixel sizes of the crops into the description. ;-)
Wicked man - very much interested as I didn't know about this alternative, so thank you for sharing.
One question:
Where does "Prevalues.GetPreValues" get the data from - is it cached somewhere to prevent the database call. Or is this simply a method that in the end is in fact making a database call to get the data.
/// <summary>
/// Gets the pre values collection.
/// </summary>
/// <param name="DataTypeId">The data type id.</param>
/// <returns></returns>
public static SortedList GetPreValues(int DataTypeId)
{
SortedList retval = new SortedList();
IRecordsReader dr = SqlHelper.ExecuteReader(
"Select id, sortorder, [value] from cmsDataTypePreValues where DataTypeNodeId = @dataTypeId order by sortorder",
SqlHelper.CreateParameter("@dataTypeId", DataTypeId));
int counter = 0;
while (dr.Read())
{
retval.Add(counter, new PreValue(dr.GetInt("id"), dr.GetInt("sortorder"), dr.GetString("value")));
counter++;
}
dr.Close();
return retval;
}
So looks like underlying db call.. I actually mistyped... was meaning more a direct db call.. eg should the db ever change this should still work as the underlying core should be updated too. ;-)
Alternative to sql script...
might be of interest... I refactor the sql script for selecting the prevalue so that it isn't a database call and for our needs added in the pixel sizes of the crops into the description. ;-)
Hi Mike
Wicked man - very much interested as I didn't know about this alternative, so thank you for sharing.
One question:
Where does "Prevalues.GetPreValues" get the data from - is it cached somewhere to prevent the database call. Or is this simply a method that in the end is in fact making a database call to get the data.
I ask as I am curious to learn more.
Cheers, Nigel
from umbraco.codeplex.com source....
So looks like underlying db call.. I actually mistyped... was meaning more a direct db call.. eg should the db ever change this should still work as the underlying core should be updated too. ;-)
Hi Mike
Ahh - I did do a quick google search but didn't take the time to track down the source code.
Totally agree that using a method (over a direct SQL query) is a more robust solution so can look to update the package accordingly.
Cheers for the input - you are part of the very reason why this community is successful - open and sharing of information.
Nigel
is working on a reply...