适用于 CQRS 开发的 Resharper 6 实时模板
ddd-cqrs 列表上有一些关于人们使用 Resharper 实时模板来帮助处理 CQRS 开发时获得的样板代码的讨论。
这是克服样板疯狂的最佳方法吗?有人愿意与社区分享吗?
There's been some chatter on the ddd-cqrs list about people using Resharper live templates to help take care of the boilerplate code that you get when doing CQRS dev.
Is this the best way to overcome the boilerplate madness and does anyone have any they'd like to share with the community?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CQRS 最基本的功能是将查询和命令分开。如此简单的概念实际上不需要任何样板代码(因此对 ddd-cqrs 列表上的框架产生强烈反对)。
也就是说,带有事件源的 CQRS 确实有相当多的您需要生成的样板代码。就像所有本质上重复的代码一样,使用 ReSharper 实时模板之类的东西听起来是个好主意。
问题在于,模板的使用是否会阻止人们改进事物或改变事物的完成方式。模板应该被视为需要维护和保养的生命体,这样您就不用担心改进实施。
CQRS at its most basic is about keeping your queries and your commands separated. A concept this simple shouldn't actually require any boiler plate code (hence the backlash against frameworks on the ddd-cqrs list).
That said, CQRS with Event Sourcing DOES have quite a bit of boiler plate code you need generated. And like all code that is repetitive in nature using something like ReSharper live templates sounds like a great idea.
The problem will be if usage of the templates stops people from improving things or changing how things are done. The templates should be considered as living things that need to be maintained and cared for so that you're not afraid of improving your implementation.