How to avoid having very large objects with Domain Driven Design

The issues you are seeing aren’t caused by Domain Driven Design, but rather by a lack of separation of concerns. Domain Driven Design isn’t just about placing data and behavior together. The first thing I would recommend is taking a day or so and reading Domain Driven Design Quickly available as a free download from … Read more

How to get Uri.EscapeDataString to comply with RFC 3986

Having not been able to get Uri.EscapeDataString to take on RFC 3986 behavior, I wrote my own RFC 3986 compliant escaping method. It leverages Uri.EscapeDataString, and then ‘upgrades’ the escaping to RFC 3986 compliance. /// <summary> /// The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. /// … Read more

Given a Member Access lambda expression, convert it to a specific string representation with full access path

public string GetPath<T>(Expression<Func<T, object>> expr) { var stack = new Stack<string>(); MemberExpression me; switch (expr.Body.NodeType) { case ExpressionType.Convert: case ExpressionType.ConvertChecked: var ue = expr.Body as UnaryExpression; me = ((ue != null) ? ue.Operand : null) as MemberExpression; break; default: me = expr.Body as MemberExpression; break; } while (me != null) { stack.Push(me.Member.Name); me = me.Expression … Read more

Is it possible to wildcard logger names in log4net configuration?

You can just specify part of a namespace so it will apply to all messages within that namespace (including nested). Here is the example I often use: <root> <level value=”FATAL” /> <appender-ref ref=”RollingFile” /> </root> <logger name=”MyCompany.Web” > <level value=”WARN” /> <appender-ref ref=”WebErrors” /> </logger> <!– Will log all FATALs from NHibernate, including NHibernate.SQL and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)