Reputation: 1879
What tools are people using for querying their Read database and populating DTO's?
We currently have our Read model in a Sql2008 database and perform all our queries through a WCF service, We're using Fluent NHibernate to populate the data contracts using auto-mapping, but maybe this is just overkill?
Our requirements are really this...
Upvotes: 3
Views: 961
Reputation: 2892
I have used WCF Data Services with a lot of success on the read side. I have written a blog post about it. Check it out at http://blog.fossmo.net/post/WCF-Data-Services-A-perfect-fit-for-our-CQRS-implementation.aspx
Upvotes: 1
Reputation: 9799
I used ADO.NET core with stored procedures in the database. Then using a tool I've written, all of the data access code is generated using the result of each stored procedure as the structure of Dtos.
The tool with source code is available on my blog Data Access Layer CodeGen
Now since you're simply returning the data via a WCF service, then there is no need to go from DataReader, to Dto and then serialize the DTO. In other words, you're iterating over your resultset 3 times in the process of sending the data out. So if you want to reduce the resource utilization on your server and get better performance then you can use the "DataReader-Wrapper" classes that the tool generates (along with the Data access code).
The DataReader wrapper classes are like strongly typed DataReaders. I have another post where I talk about these and their benefits DataReader Wrappers - TypeSafe
Of course, you could modify the tool (since you have the source code as well) to generate all of your code including the WCF service. So all you really have to do is write a stored procedure and you're done. All of the DataAccess code (using ADO.NET Core - so it's lightweight and super fast), business layer code and WCF code is really just "busy work" if you get what I mean.
EDIT Reason for using stored procedures
Upvotes: 0
Reputation: 23552
IMHO Overkill.
I'm using just a flat file system with JSON/ProtoBuf serialization. Web services are dead simple and schema can be anything. The stack easily moves to the cloud (using Azure Storage Blobs) for almost-infinite scalability as needed.
Details: http://abdullin.com/journal/2011/1/19/scalable-and-simple-cqrs-views-in-the-cloud.html
Upvotes: 3