Disconected API

2 posts, 0 answers
  1. Hans
    Hans avatar
    49 posts
    Member since:
    Jul 2010

    Posted 08 Dec 2010 Link to this post

    Hi !

    I try the new ORM model and I can't figure out how to use it in disconnected environment:

    I have this code :


     

    public static ObjectContainer.ChangeSet GetContractors()

     

    {

    ObjectContainer.ChangeSet changeSet =

     

    null;

     

     

     

    using (TslDBContext dbContext = new TslDBContext())

     

    {

     

     

    IQueryable<Contractor_List> contractors = from c in dbContext.Contractor_Lists select c;

     

     

     

    var container = new ObjectContainer();

     

    IObjectCollector collector =

     

    new FetchGroupCollector(FetchGroupCollector.DefaultFetchGroup);

     

    container.CopyFrom((IObjectScope) dbContext,

     

    typeof(Contractor_List).Name, contractors, collector);

     

    changeSet = container.GetContent();

    }

     

     

    return changeSet;

     

    }

    but I don;t know how to wrap the list contractors in a changeset . Dbcontext cannot be casted to IObjectscope.

    Do you have any example with this new orm model in disconnected environment ?  The book open access made easy is outdated and
    I can't find anything to help me. Really, guys, you have great products but the documentation sucks . I don't want to spend one week searching how to make one line of code.If you want to prom ote a new way to work , please document it.
    I tried data wizard and is not working with Winforms , only with web forms.

    Regards,
    Hans

     

  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 09 Dec 2010 Link to this post

    Hi Hans,

     I am sorry that you feel disappointed. At the moment we have no support for the Disconnected API when using the context class, the container can only be filled with the use of an IObjectScope. 

    As you might know though, the new context internally operates with a scope object that  you can access and use as you would with OpenAccess Classic. In order to expose it you will need to create a partial class, your code should look like : 

    public partial class YourContextName
    {
        public IObjectScope Scope
        {
            get
            {
                return this.GetScope();
            }
        }
    }

    We have plans on providing a new disconnected API however there are more pressing matters at the moment and I cannot pinpoint a date for this feature. 

    I hope this is helpful and please let us know if you face further trouble or something is left unclear.


    Greetings,
    Serge
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  3. DevCraft banner
Back to Top