Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / OpenAccess ORM > General Discussions > How to retrieve only one object

Not answered How to retrieve only one object

Feed from this thread
  • Yang avatar

    Posted on Jan 5, 2012 (permalink)

    Hi
     I'm trying to retrieve only current object ,not including children objects:

                FetchStrategy fetchStrategy = new FetchStrategy();
                fetchStrategy.MaxFetchDepth = 1;
                fetchStrategy.MaxResultsLimit = 1;
                dbContext.FetchStrategy = fetchStrategy ;

                IEnumerable<Sample> samples = dbContext.Sample.Where(s => s.SampleBarcode == sampleBarcode);

    but result includes many children object,such as Sample.SampleItem ...

    Tell what should I do .

    Thanks
    Dgyang

    Reply

  • Damyan Bogoev Damyan Bogoev admin's avatar

    Posted on Jan 5, 2012 (permalink)

    Hello Yang,

    Initially only the current object is being retrieved. If you try to access some of the navigation members of this object, additional calls to the database will be made in order to retrieve the necessary information for them. This means that the navigation members are loaded on-demand.
    Hope that helps.

    Kind regards,
    Damyan Bogoev
    the Telerik team

    Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / OpenAccess ORM > General Discussions > How to retrieve only one object
Related resources for "How to retrieve only one object"

OpenAccess ORM Features  |  Documentation  |  Demos  |  Telerik TV  |  Step-by-step Tutorial   ]