Getting an Object based on an OQL Query

2 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 20 Jul 2010 Link to this post

    WIth the Designer Context Method, I want to Query OA and return a single object back to the WF designer to play around with

    public class OASingleObjectOQL<TResult> : NativeActivity<TResult> where TResult : class
        public InArgument<string> OQLQuery { get; set; }      
        public OASingleObjectOQL()
        protected override void Execute(NativeActivityContext context)
            OAObjectContext oaObjectContext = context.Properties.Find(OAObjectContext.ObjectContextPropertyName) as OAObjectContext;
            if (oaObjectContext == null)
                throw new ValidationException("OpenAccess Object Context not found");
            var output = ""; //QUERY CODE...?
            // set the result value
            this.Result.Set(context, output);          

    I don't see any OQL query methods in my context....

    Or is there a more efficient way to return a single object?...I'd try a Predicate, but I'm not sure of the VB style syntax to do that in the WF4 designer
  2. Jordan
    Jordan avatar
    547 posts

    Posted 21 Jul 2010 Link to this post

    Hello Steve,

    OQL is not supported by the context, generated by the visual designer.
    You could however, use Dynamic Linq together with the GetAll<T> method of the context (in order to get an IQueryable instance).

    I hope this helps. Do not hesitate to write again if you have more questions.

    All the best,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top