I've tried your suggestion of making the query more specific with:
using System;
using System.Linq;
using System.Globalization;
using Composite.Core.Xml;
using Composite.Data;
using Composite.Data.Types;
namespace My.Data.Method
{
public static class InlineMethodFunction
{
public static string GetPageTitle(DataReference<IPage> Page)
{
if (Page == null || Page.Data == null)
{
return null;
}
else
{
using (DataConnection connection = new DataConnection(PublicationScope.Published, new CultureInfo("en-GB")))
{
string PageTitle = (from Page1 in connection.Get<IPage>()
where Page1.Id == (Guid)Page.KeyValue
select Page1.Title).First();
return PageTitle;
}
}
}
}
}
... but am still getting the error message on the French page (but not on the English one):Error: Failed to get value for function 'My.Data.Method.GetPageTitle'
Function: My.Data.Method.GetPageTitle
Exception has been thrown by the target of an invocation.
No data exist given the data key values