Join our community!

Get everything you need to start developing EPiServer solutions.

Dynamic Data Store Tips: Don’t use Find when you know an object’s “Id”

  • Number of votes: 2
  • Views: 3189
  • Average rating:

I have seen a few examples of code where an object is to be read from the Dynamic Data Store. The calling code has the objects “Id” value but use the Find method of DynamicDataStore to load the object.

Find works by generating a simple where clause against the store’s database view. The problem here is that the “Id” column in a store’s view is a non indexed manufactured string value based on the underlying StoreId (int) and ExternalId (Guid). Searching against this will be slow when dealing with a large number of rows.

If you know the “Id” of an item you should ALWAYS use the Load method of the DynamicDataStore. Load searches directly against either the StoreId or ExternalId columns, both of which are indexed.

See my previous blog entry Best (and fastest) ways to load items from the Dynamic Data Store for more details of loading.

Happy loading!

Comments

About the blogger

Paul Smith
Active Solution
Participating Citizen

I am an EPiServer Alumni. At EPiServer I contributed to all CMS 5 and 6 versions working with the backend system, installation / deployment as well working as a Developer Evangelist. I am now a freelance developer working with ASP.NET and EPiServer technologies.

Syndication and Sharing