Scott HannenAbout The Interface Segregation Principle Applied in .NET Jan 1, 2019 The common definition of the Interface Segregation Principle (ISP) is: No client should be forced to depend on methods it does not use. This predates the .NET Framework, so how can we apply it to .NET code? The “client” is a class that depends on another class or interface. The word “interface” doesn’t refer specifically to the interface keyword. A class could depend on the public members of another class. But we often write our “client” classes to depend on interfaces defined with the interface keyword. So, while this post (and many others) apply the principle to interfaces declared with the interface keyword, the principle is not limited to that.
Double dispatch is a pattern you can use in C# to control how communication flows between two objects. A frequent use of the pattern is to pass “this” to a function on another class, allowing that class to communicate back to or manipulate the calling object instance. It can also be used to achieve polymorphic behavior. I have a GitHub sample you can browse or download that demonstrates some of these techniques.
阅读目录 熔断是什么 熔断怎么做 做熔断的最佳实践 总结 当我们工作所在的系统处于分布式系统初期的时候，往往这时候每个服务都只部署了一个节点。 那么在这样的背景下，如果某个服务A需要发布一个新版本，往往会对正在运行的其它依赖服务A的程序产生影响。甚至，一旦服务A的启动预热过程耗时过长，问题会更严重，大量请求会阻塞，产生级联影响，导致整个系统卡慢。 举个夸张的例子来形容：一幢楼的下水管是从最高楼直通到最低楼的，这个时候如果你家楼下的管道口堵住了，那么所有楼上的污水就会倒灌到你家。如果这导致你家的管道口也堵住了，之后又会倒灌到楼上一层，以此类推。 然而实际生活中一旦你发现了这个问题，必然会想办法先避免影响到自己家，然后跑到楼下让他们赶紧疏通管道。此时，避免影响自己家的办法就可被称之为「熔断」。
Continuing this series on CQRS and ES in .NET, we’re now going to focus on Event Handlers. I previously covered: CQRS/ES The Command The Command Handler The Repository The Domain Object If you haven’t read them, I advise you to to so first. Read them in order, because they build upon each other. If you’re already familiar with CQRS and Event Sourcing, you can skip the first one.