IronPython and Entity Framework

Possibly really simple question, but I'm new to IronPython. I would like use IronPython to crawl an entity I pass to it, but when I try to use any extension methods, it, as sort of expected, blows up. How do I traverse my POCOs in IronPython?

delegate bool EvaluateRule(MyEntity entity);
//Keep in mind this is just to test, no actual value provided
string expression = @"entity.Flags.FirstOrDefault() == null";
MyEntity entity = new MyEntity();
PythonEngine engine = new PythonEngine();
EvaluateRule rule = engine.CreateLambda<EvaluateRule>(expression);
bool result = rule.Invoke(entity);

I get the following: 'EntityCollection[MyEntity]' object has no attribute 'FirstOrDefault'

Thanks in advance!


You can call the extension methods as regular static methods:

string expression = @"Enumerable.FirstOrDefault(entity.Flags) == null";

Need Your Help

Debugging JS in CRM 2011 Outlook Client

javascript dynamics-crm-2011

I am looking for a way to debug the Microsoft CRM 2011 Outlook client. We are having an issue on one of our functions that is only happening in the outlook client, and I would like to be able to ga...