Collect(,,,) throws exception
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Collect(,,,) throws exception Expand / Collapse
Author
Message
Posted 2010-04-21 13:52:08
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-04-13 12:29:45
Posts: 75, Visits: 544
I Have following ocl =
"SystemUser.allInstances->Collect(p|p.FirstName,p.LastName)"
i want to get result elements as List.
i evaluating expression, in returns IElementCollection - >class ElementCollectionConstantImpl
when i evaluate
for example this code ocl("SystemUser.allInstances->Collect(p|p.FirstName,p.LastName)")
code

var sp = EcoSpace;

var ocl = sp.GetEcoService();
new SystemUser(sp) { Age = 1, FirstName = "George", LastName = "Harrison" };
new SystemUser(sp) { Age = 1, FirstName = "John", LastName = "Lenon" };
new SystemUser(sp) { Age = 1, FirstName = "Pol", LastName = "McCartney" };
var result = ocl.Evaluate("SystemUser.allInstances->Collect(p|p.FirstName,p.LastName)");
try
{
var res = result.AsObject;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"Exception" ); //--> throws here
}
var lst = new List();
foreach (var obj in (IElementCollection)result)
{
lst.Add((IElement)obj);
}
MessageBox.Show(string.Format("Manual Collection contains {0} elements",lst.Count), "Exception");

if evaluation contains no items any exception is thrown.
is it bug?
any way i will post bugreport.
http://magpie.no-ip.com/mantis/view.php?id=902


Alex
Post #5163
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 10:13

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,234. 9 queries. Compression Disabled.