I have a function:
private static PrivateMessage GetPM()
{
using (var db = new DBContext())
{
var q = CompiledQueries.GetPMByID(db, messageID);
if (q == null) return null;
return new PrivateMessage(q);
}
}
I wish to pass this function as a parameter:
var pm = cacheObj.SetIfNotExists(GetPM);
Where SetIfNotExists
is defined as:
public T SetIfNotExists<T>(Func<T> getCachableObjectFunction)
What do I need to modify so that I can pass messageID
as a parameter in GetPM()
? EG:
private static PrivateMessage GetPM(int messageID)