I was wondering about the different ways people may handle configuration data in CRM.
Here are the challenges that I see (and I’m still looking for a solution):
- Create a dictionary (key value pairs) that can be made available to plugins.
- Cache this dictionary somehow (one user request can trigger dozens of chained plugins and would be a waste to submit all these requests to retrieve the exactly same data).
- It should be easy to maintain
I came across these blog posts where the authors mentioned Actions.
I love them and I see many different cases where they are a good fit but not for this one.
Some downsides:
- In a large application we can have 100+ keys and the Auction UI is not ideal to manage this volume
- In order to change one single value the whole application needs to be stopped. Prior to edit an action you need to deactivate it. During that time all plugins will fail. This is a huge deal in a large/busy environment.
Dynamics CRM documentation mentions lightweight queries when it comes to metadata.
From MSDN:
“You do not have to cache this data because you can use the Microsoft.Xrm.Sdk.Metadata.Query classes to retrieve this data directly from the Microsoft CRM application cache.”
I’m not sure what they mean by “Lightweight” query, when looking into a profiler you can see the database is still hit after you submit a metadata request. Perhaps it is just looking for versioning info and this could be where the lightweight comes from?
Anyways, sounds really cool and we could leverage it if only we could add a custom metadata property to an entity, something like “MyData”. Since it is metadata the “Application Cache” would cache all metadata properties (such as “CanCreateViews”) and include “MyData” to it. Sounds too good to be true so we probably can’t do it.
The most appealing approach (from usability point of view) is still storing the configuration on an custom entity but that brings the question: how can we cache it?
Thanks in advance for you comments and/or suggestions.