This is a migrated thread and some comments may be shown as answers.

Disconected API

1 Answer 24 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hans
Top achievements
Rank 1
Hans asked on 08 Dec 2010, 09:08 PM
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

 

1 Answer, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 09 Dec 2010, 07:43 PM
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.
Tags
Getting Started
Asked by
Hans
Top achievements
Rank 1
Answers by
Serge
Telerik team
Share this question
or