This question is locked. New answers and comments are not allowed.
I've been evaluating Telerik ORM and trying to decide whether we can use it instead of the Entity Framework in a Silverlight Business app I am in charge of. I have run into an issue involving lazy loading. I was somewhat disappointed to see that it could not be turned off. Having it turned on by default when using RIA and Silverlight doesn't seem like a very good idea, because you easily have the potential for huge object graphs to be automatically fetched from the database during the serialization operations.
Anyway, I was trying to understand how to work around this with fetch strategies, but I'm not sure exactly how to approach this with stored procedures. Basically, we have a significant number of stored procedures that already return all information needed from various tables using multiple result sets. We also have a number of other instances where all necessary values are loaded in a single domain service by making several separate stored procedure calls.
However, with Telerik ORM, I'm not sure how to prevent the context from automatically loading all related items even after the stored procedure has already brought back all the necessary information. Is there a way to apply a fetch plan to a stored procedure?
For example, I have one SPROC that brings back information from two related tables in two different result sets. If I retrieve the reader and then translate the 2 result sets to the appropriate entities, I should have all the values I need. But, when I run a trace, I see that the Telerik ORM is automatically fetching all the related items again. There are very often more than 1000 results from this query (and many others in the app), and this kind of lazy loading results in more than 1000 calls to the DB. Our DBA especially gets very leary about this.
Below is an example of how I'm calling the stored procedure using the GetReader method generated along with the Domain Method. Can you advise on how to do this differently or apply a fetch plan to this?
Anyway, I was trying to understand how to work around this with fetch strategies, but I'm not sure exactly how to approach this with stored procedures. Basically, we have a significant number of stored procedures that already return all information needed from various tables using multiple result sets. We also have a number of other instances where all necessary values are loaded in a single domain service by making several separate stored procedure calls.
However, with Telerik ORM, I'm not sure how to prevent the context from automatically loading all related items even after the stored procedure has already brought back all the necessary information. Is there a way to apply a fetch plan to a stored procedure?
For example, I have one SPROC that brings back information from two related tables in two different result sets. If I retrieve the reader and then translate the 2 result sets to the appropriate entities, I should have all the values I need. But, when I run a trace, I see that the Telerik ORM is automatically fetching all the related items again. There are very often more than 1000 results from this query (and many others in the app), and this kind of lazy loading results in more than 1000 calls to the DB. Our DBA especially gets very leary about this.
Below is an example of how I'm calling the stored procedure using the GetReader method generated along with the Domain Method. Can you advise on how to do this differently or apply a fetch plan to this?
public IQueryable<Costing> GetCostings() { IEnumerable<Costing> costings; using (var reader = DataContext.GetReaderForusp_search_default2(null, 1, 65, 1, "joeuser", true, 1, 1, 26)) { costings = DataContext.Translate<Costing>(reader).ToList(); reader.NextResult(); var refs = DataContext.Translate<Reference>(reader).ToList(); reader.NextResult(); var prods = DataContext.Translate<Product>(reader).ToList(); } return costings.AsQueryable(); }