dynamically get entity data by name string ( .GetAll("Orders") )

2 posts, 0 answers
  1. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 02 Dec 2012 Link to this post

    Hello,

    I've been at it for a few hours now, but with no result.

    basically, what I want to do is this:

    For Each str_EntityName As String In str_TableNames
        Dim lst_Data as List(Of Object) = Context.GetAll(str_EntityName)

    Now, there is a function GetAll(Of XXXX), but in the loop I do not know the object type, only in a string.

    I've been looking at scope.GetOqlQuery and ExecuteQuery, but nothing helped so far (GetOqlQuery did not return anything, using "Extent")

    Could someone point me to the right direction?

    Thanks in advance!

    Erik
  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 06 Dec 2012 Link to this post

    Hello Erik,

     You need to add a reference to the 'Telerik.OpenAccess.35.Extensions' and then you can use the extension method on the IObjectScope - 'ExtentByName'. ex - scope.ExtentByName(typeName). Note that the type name has to be the fullname (without assembly specification)

    Do get back in case you need further assistance.

    Greetings,
    Ady
    the Telerik team
    Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
  3. DevCraft banner
Back to Top