qury result from context schema to container ?

Thread is closed for posting
2 posts, 0 answers
  1. Marchand
    Marchand avatar
    15 posts
    Member since:
    Sep 2008

    Posted 24 Nov 2010 Link to this post


    i just want to know how can I do to add the result of OQL result to a caontainer (with disconned mode) ?

    Example of code with scope object :
    ==> but I want to use context database .... How can I  do ?
    In advance, thanks....

     ObjectContainer.ChangeSet ccData = null;
                    IObjectScope os = ISSYS_Qualification_BO.ObjectScopeProvider.GetNewObjectScope();

                        string resultName = "User";
                        string query = "from u in this.Context.Users select u";
                        IQuery qry = os.GetOqlQuery(query);
                        IQueryResult qres = qry.Execute();

                        ObjectContainer oc = new ObjectContainer();

                        // default deep
                        Telerik.OpenAccess.IObjectCollector objCollector =
                            new FetchGroupCollector(FetchGroupCollector.DefaultFetchGroup);

                        if (qres != null)
                                int cnt = qres.Count;
                                oc.CopyFrom(os, resultName, qres, objCollector);
                            catch (Exception exc)
                                string msg = exc.Message;
                                oc.CopyFrom(os, resultName, qres, null);
                            oc.CopyFrom(os, resultName, qres, null);

                        ccData = oc.GetContent();
                    return ccData;

  2. Petko_I
    Petko_I avatar
    184 posts

    Posted 26 Nov 2010 Link to this post

    Hello Marchand,

    You can gain access to an internal scope related to the OpenAccessContext by extending the definition of the partial class where the derived context resides.
    public partial class NorthwindEntityDiagrams : OpenAccessContext
        public IObjectScope GetInternalScope()
            return this.GetScope();
    The OQL API is supported only with the scope approach. I hope this is what you are looking for.

    Do not hesitate to contact us to discuss anything that you find important.

    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Back to Top