STRING_AGG aggregation result exceeded the limit of 8000 bytes error

Try as below select c.id , c.bereichsname , STRING_AGG( CAST(j.oberbereich as nvarchar(MAX)),’,’) oberBereiches from stellenangebote_archiv j join bereiche c on j.bereich_id = c.id group by c.id, c.bereichsname So the problem is the length of the concatenated string is exceeding the character limit of the result column. So we are setting the limit to max by … Read more

What Belongs to the Aggregate Root

After doing even MORE research, I think I have the answer to my question. Paul Stovell had this slightly edited response to a similar question on the DDD messageboard. Substitute “Customer” for “Employee”, and “Order” for “Violation” and you get the idea. Just because Customer references Order doesn’t necessarily mean Order falls within the Customer … Read more

Using Enumerable.Aggregate(…) Method over an empty sequence

To concatenate a list of strings, use the string.Join method. The Aggregate function doesn’t work with empty collections. It requires a binary accumulate function and it needs an item in the collection to pass to the binary function as a seed value. However, there is an overload of Aggregate: public static TResult Aggregate<TSource, TAccumulate, TResult>( … Read more

AggregateException C# example

You need to call Handle on the inner exceptions. From MSDN’s documentation on Handle: Each invocation of the predicate returns true or false to indicate whether the Exception was handled. After all invocations, if any exceptions went unhandled, all unhandled exceptions will be put into a new AggregateException which will be thrown. Otherwise, the Handle … Read more