3 Answers, 1 is accepted
0
Hi bin,
However this might only help you if you are using OQL to retrieve data.
I hope this is helpful. All the best,
Serge
the Telerik team
Unfortunately at the moment it is impossible to retrieve information based on the table name. However it should be possible to retrieve the persistent type name based on the table name using the metadata model that is available trough the scope.
You can do so using code like:
var model = scope.Database.MetaData;string tableName = "table-name";var persistentType = model.PersistentTypes .FirstOrDefault(x => x.Table != null && string.Equals(x.Table.Name, tableName));string typeName = persistentType.FullName;However this might only help you if you are using OQL to retrieve data.
I hope this is helpful. All the best,
Serge
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
XXXX
Top achievements
Rank 1
answered on 13 May 2011, 02:52 PM
This is of interest to me as I want to query a table that is not part of the DomainModel.
Using IObjectScope.GetSqlQuery will be database depentant and I would like to solve this without having diffrent queries depending what the backend type is.
Has anyone a workaround ?
Using IObjectScope.GetSqlQuery will be database depentant and I would like to solve this without having diffrent queries depending what the backend type is.
Has anyone a workaround ?
0
Hello Bjössi,
I am afraid that the only way to retrieve information from a table which is not part of the model is to create a stored procedure in the database which returns the needed data. Then you can add this stored procedure to your model and execute it as a method of the OpenAccessContext instance. This method would return an object array which you can easily traverse to get the data.
Regards,
Alexander
the Telerik team
I am afraid that the only way to retrieve information from a table which is not part of the model is to create a stored procedure in the database which returns the needed data. Then you can add this stored procedure to your model and execute it as a method of the OpenAccessContext instance. This method would return an object array which you can easily traverse to get the data.
Regards,
Alexander
the Telerik team