I'm using Dapper mainly for calling stored procedures in the database MSSQL 2008 R2.I do not have classes that map to database tables. Most of the data ends up in IEnumerable <Dynamic>
and is transmitted to the grid on the screen.
Is there a ready to use solution for data buffering that I could use? (I need to use it on the MVC).
The data in the database are both static and dynamic in nature.I use the repository model to access the data.
When a stored procedure is executed it is optimized and compiled and the query plan is placed in procedure cache. Procedures remain in cache for other users, as long as there is space.
Using stored procedures with Dapper can be a great way to take advantage of the strengths of the database while reducing complexity of your code.
Dapper caches information about every query it runs, this allow it to materialize objects quickly and process parameters quickly. The current implementation caches this information in a ConcurrentDictionary object.
The procedure cache is part of the larger memory pool for SQL Server. Starting with SQL Server 7.0, individual parts of the memory pool are. dynamically controlled by SQL Server with no documented option for the DBA to. specifically configure a percentage of the memory pool just for the procedure.
Dapper doesn't include any inbuilt data caching features (although it uses extensive caching internally for the meta-programming layer): it aims itself squarely at the ADO.NET stuff - however, you could use pretty much any off-the-shelf caching component, including the HTTP runtime cache (HttpContext.Current.Cache
), or the newer ObjectCache
etc implementations. Because these just take objects, it should work fine.
If you are using a distributed cache (maybe via app-fabric, redis, or memcached) then you'd need the data to be serializable. In that scenario, I would strongly suggest using formal POCO types for the binding, rather than the dynamic
API. As an example, in-house we use dapper to populate POCOs that are annotated with protobuf-net markers for serialization, and stored via BookSleeve to redis. Which sounds more complicated than it actually is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With