This is a strange phenomena, and I hope someone can take this one...
I have this class:
Class Parent
{
some members;
IList<Child> mylist;
}
Class Child : Parent
{
}
They are map with HasMany in Fluent.
now I'm calling the List function over wcf
and unless I remove the HasMany mapping from the father, The WCF List Function (that do this inside:
public IMyID[] List(string typeName)
{
IMyID[] result = null;
try
{
using (ISession session = SessionFactoryProvider.NewSession)
{
Type relevantType = Type.GetType(typeName);
ICriteria crit = session.CreateCriteria(relevantType);
IList<IMyID> queryResult = crit.List<IMyID>();
if (queryResult != null)
{
result = queryResult.ToArray();
}
}
}
catch (Exception ex)
{
}
return result;
So - As Long as the Parent has the HasMany Mapping - This function goes TWICE (although only one WCF call is invoked, and I've checked that also in the trace) and the WCF channel breaks.
If I remove the "HasMany" mapping, everything is working.
If I comment this line: IList queryResult = crit.List();
it will run only once... (returning null...)
Any Ideas what makes this function run twice, and break the WCF Channel ?
Thanks, Einat.