Hot answers tagged

17

Since the reference to the wrapped XElement is immutable, there is no externally observable difference between two instances of XmlWrapper that wrap the same element, so it makes sense to overload == to reflect this fact. Client code almost always cares about logical equality (which, by default, is implemented using reference equality for reference types). ...


10

If you're arriving at this a little late, like me, it turns out the .NET team addressed it through a bunch of parameter attributes like MaybeNullWhen(returnValue: true) in the System.Diagnostics.CodeAnalysis space which you can use for the try pattern. For example: how does generic code like Dictionary.TryGetValue deal with this? bool TryGetValue(TKey ...


8

If you think it makes the most sense The question and answer is a matter of developer expectation, this is not a technical requirement. IF you consider a wrapper to not have an identity and have it be defined purely by its contents, then the answer to your question is yes. But this is a recurring problem. Should two wrappers exhibit equality when they ...


5

Pagination is not a domain concern. The domain layer typically does not care to know the number of records fetched from a persistence store. It is a performance concern, specifically on the database side. And the only domain elements that deal with the database are repositories. So the way I see it, you need a mechanism to send it from the API request (or ...


2

You are basically comparing strings so I would be astonished if two wrappers containing the same XML content would not be considered equal, be it checked using Equals or ==. The idiomatic rule may make sense for reference type objects in general but strings are special in an idiomatic sense, you are supposed to treat and regard them as values although ...


2

Let's start with Microsoft's documentation for IQueryable. It says: The IQueryable interface inherits the IEnumerable interface so that if it represents a query, the results of that query can be enumerated. Enumeration causes the expression tree associated with an IQueryable object to be executed. The definition of "executing an expression tree" is ...


1

From an RDBMS point of view, Order and OrderLine are two tables without a doubt. The decision on whether to nest OrderLine within Order is dependent on answers to three questions: Do the business rules of Order include maintaining data spread across Order and OrderLine? For example, the order amount is always equal to the sum(qty * price) of all OrderLines. ...


Only top voted, non community-wiki answers of a minimum length are eligible