This is a migrated thread and some comments may be shown as answers.
Enhancement to GetObjectByID
3 Answers 25 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.
Alfred Ortega
Top achievements
Rank 2
Alfred Ortega asked on 06 Oct 2009, 11:56 AM
Add a new method to the scope class with the following signature:

public T GetObjectByID<T>(string objectID){}

I think it's easier and more intuitive than the current method.

Al

3 Answers, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 08 Oct 2009, 05:36 AM
Hello Alfred Ortega,

We will take a look at the Telerik OpenAccess API in order to find out where generic methods are missing. We will do our best to add the missing items in the future.
We appreciate your proposal.

Kind regards,
Damyan Bogoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Alfred Ortega
Top achievements
Rank 2
answered on 08 Oct 2009, 12:23 PM
That is great news - thank you.

Do you know when (or if) the following will be supported?

 
 
var results = from items in objectScope.Extent<Foo>()  
              where items.Discontinued == true 
              select items;  
 
objectScope.RemoveAll(results); 

As shown in Scott Guthries blog (http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx)

Al
0
Damyan Bogoev
Telerik team
answered on 09 Oct 2009, 03:17 PM
Hello Alfred Ortega,

In fact, the query that you provided is supported. You should use the IObjectScope Remove method. It can accept as parameter IEnumerable or IEnumerator variables as well as single persistent capable instances:

var results = from items in scope.Extent<Product>()
              where items.Discontinued == true
              select items;
scope.Transaction.Begin();
scope.Remove(results);
scope.Transaction.Commit();

If  the table, from which you are deleting records with the preceding query, is a parent table you can use cascading delete as well.
Additional information about the cascading delete option can be found in the following Knowledge Base article - CRUD example with Telerik OpenAccess ORM. There is also a demo project in the Code Library - Implementing cascading delete with Telerik OpenAccess ORM.
I hope you will find this information helpful. If you have any other questions, please do not hesitate to contact us.

Regards,
Damyan Bogoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Integration with other products
Asked by
Alfred Ortega
Top achievements
Rank 2
Answers by
Damyan Bogoev
Telerik team
Alfred Ortega
Top achievements
Rank 2
Share this question
or