EF Core Lazy Loading

Hi radzen team,
is it possible to change the O/RM pattern of an radzen app to lazy loading?
Or there any reasons why lazy loading isnt active as standard in radzen app?


Are you referring to this?

Yes. So far as i understand loads lazy loading the navigation properties if they are needed. So only when someone wants to get related data then ef core load it.

when i understand it right in radzen... when i have an order and i need the orderdetails list i have to load it via getOrdetails with filter on orderid and then put the result in a property (load event on page). Because order.Orderdetails List is null.


Radzen loads related data in two ways since the very first version (both Angular and Blazor):

  • with main query (eagerly - when $expand parameter is specified both for navigation and/or collection properties).
  • explicitly (via separate database call).

The lazy loading was introduced in .NET Core 2.1 but frankly I fail to see any major performance benefit for Radzen applications. You either load child data initially which saves additional database calls or you load them explicitly when needed with separate database call.

hi @enchev,
ok. understand.
in load event i call getArtikelbyArtikelId(). Now i want to $expand the Artikel.ArtikelFahrzeugarts collection in Artikel

but there is no $expand parameter. how can i load the ArtikelFahrzeugarts collection?

I want to change and update the ArtikelFahrzeugarts collection on the page.


$expand parameter is available only for related entities - for all other cases you can use separate database call with $filter parameter.

As i posted here:


as i understand that will be automatically done with lazy loading. When i made a query on artikel.artikelfahrzeugarts then it will be "lazy loaded". if i dont make a query nothing will be loaded. i think lazy loading will make our lives in radzen easier. no getthis... set property... getthat... set property and so on. we can go directly on the collection property

Or is there a missunderstanding of lazy loading on my side?


We prefer developers to have control instead automatic lazy loading.

I prefer tools that build apps which are fast, reliable and easy to maintain.

There is another reason why we haven't enabled lazy loading. It will work only in Radzen Blazor server applications. In Blazor Wasm and Angular applications data is retrieved via REST service which implements the OData protocol. There is no such thing as lazy loading - only the $expand parameter that Vladimir mentioned above.

Lazy loading is not faster than eager loading. It is very easy to make a lot of DB calls without even realising why. Eager loading requires more code but is predictable and reduces the risk of overloading the database.

Hi @korchev Hi @enchev,

Thats a reason i understand. Not the "developer have control" thing. If someone uses a RAD Tool he/she knows that there is no full control. I think the developers here dont want control. They want build apps fast and there for giving up some control.
I think Radzen is a very good idea. i found nothing like that on the web. And i love it. For sure there are few things that can be done easier and gives us customers/developers the opportunity to build apps faster and make fewer mistakes. Searching for mistakes/bugs and problems is time consuming and puts someone in a bad mood :slight_smile:
So when i see there might be some supposedly easier way to do things i will ask you
whether you can do that. If it cant be done all i want is a reasonable explanation why it cant be done.

Kind Regards

By the way...
How about the possibility of some type of voting or uservoice for us customers which things we think are important for us to be done in the future development of radzen?


This is as important as "works only in Blazor server". As I said lazy loading can lead to multiple unexpected DB calls. Not to mention dealing with cycles.

We have to consider a lot of facts when committing to a feature request as we don't want to add niche features or features that won't always work or can introduce a severe performance penalty if not used right. Radzen is a tiny company and we have to be very careful about how we spend our time.

At the moment we use the forum and email support for feature requests. Enabling a third party solution would require too much effort (integrating it with our payment provider so it knows who our customers are) which we prefer to spend on developing product features. Not to mention that UserVoice's pricing is beyond our reach.

Ok. Thank you for your explanation! @korchev
This let me understand the situation in a better way.

thanks again!

1 Like