Yesterday I was presented with an interesting question: How can I design a user control that change appearance when the windows containing it is maximized? Thanks to WPF binding and Triggers the solution is simple, suppose you want to create a border control that change thickness when the windows that contains this User Control is [...]

Continue reading about Change appearance of a control if the windows is maximized in WPF

Usually I access data with ORM like NHibernate or Entity Framework and resort to plain T-SQL only for reporting or manipulation of massive data, but yesterday I had to use some plain SQL to insert data in a table that has Geograpy column. Figure 1: A table with geography data If you use EF 5 [...]

Continue reading about Inserting a Geography data in Sql Server with plain C# SqlCommand

This is a common question for people that used NHibernate before using EF. The problem is, I have an object and I do not want to care about if this is a new object that needs to be added for the first time to the database, or it is an object that needs update or [...]

Continue reading about Using SaveOrUpdate in Entity Framework

The major pain when you switch from two similar tools (from NH to EF in this specific scenario) is that you need to learn again how to obtain the same results, but in a different way. Yesterday I was mapping a hierarcy of objects in Entity Framework, I’ve a scenario where Table Per Type was [...]

Continue reading about Entity Framework Code First and TPH Inheritance mapping

ELMAH is probably de-facto the most commonly used solution to create an automatic logging infrastructure in your ASP.NET application. One of the problem you can encounter using it, is that this component logs a lot of information, and particularly all POST variables of the request. If some error occours in login or registration page, you [...]

Continue reading about Avoid logging sensitive information with ELMAH