开发者

What is a good read model for an ASP.NET MVC app using CQRS?

开发者 https://www.devze.com 2023-02-17 10:42 出处:网络
I am looking to develop an ASP.NET MVC app, which should have the capability to be run on Azure in the future. The app will be using the CQRS design pattern, which I am rather new to. The write model

I am looking to develop an ASP.NET MVC app, which should have the capability to be run on Azure in the future. The app will be using the CQRS design pattern, which I am rather new to. The write model will use NHibernate with mappings. I am not sure what kind of database to use for the read model. The read model should have the following properties:

  • It doesn't need to be SQL based, but could be. NHibernate could be used there as well to create simple view model -> table type of mappings, with no foreign keys. S开发者_如何学JAVAQL CE or SQLite in memory database could be used as the data provider. This also gives a little bit more flexibility when it comes to querying the data.

  • It could simply be an object serialized / deserializer which stores the view model objects as they are. It should make this easy to use and could utilize things like Azure Blob storage in the future. Are there any good frameworks that handle this in a good way?

I would love to get some feedback from some people who have built this kind of applications before.


We are using Blob storage for CQRS Views backing up ASP.NET MVC 2 Web client (and desktop client as well). Some more details This is in production and is a great improvement over the previous version of views (NHibernate over SQL Azure)

It handles simple indexing and querying as well. For more complex scenarios I'm considering using subset of Table Storage functionality (only for really large sets that can't be partitioned).


For the Read Model, we use SQL Server 2008 R2 with WCF Data Services on top. The WCF Data Service is then configured to allow read only. The data in the SQL Server 2008 R2 database is one table per entity, with specialized Views created on top of those.

The ASP.NET MVC application doesn't access the entities directly, it only queries the views.

A scenario like this can be indexed nicely and the views give you ultimate flexibility.

0

精彩评论

暂无评论...
验证码 换一张
取 消