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

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

1 Answer 62 Views
OQL (OQL specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 2
Erik asked on 02 Dec 2012, 02:35 PM
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

1 Answer, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 06 Dec 2012, 08:39 AM
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.
Tags
OQL (OQL specific questions)
Asked by
Erik
Top achievements
Rank 2
Answers by
Ady
Telerik team
Share this question
or