In a form etc we can evaluate OCL in the DB by using an OclPSHandle, but how do you evaluate OCL in the DB in code?

This tip thanks to Jan Norden from Borland.
IOclService oclService =
(IOclService) GetEcoService(typeof(IOclService));
IPersistenceService persistenceService =
(IPersistence) GetEcoService(typeof(IPersistenceService));

AbstractCondition cond =
OclService.CreateRetrieveCondition(RootValue, EffectiveVariables(), Expression);

InternalElement = persistenceService.GetAllWithCondition(cond, MaxAnswers, Offset);

Evaluating in database OCL in code imageEvaluating in database OCL in code imageEvaluating in database OCL in code imageEvaluating in database OCL in code imageEvaluating in database OCL in code image(No Ratings Yet)
Guide tagged: