I made the mistake of using the SelectionChange event on a textbox while implementing some filtering on a DataGrid. What happened, when using SelectionChanged, was that each time the textbox received focus I was executing the filter. Even initially when there was nothing to filter. My logic was checking if the contents of the textbox […]
Read More →Author: Benjamin Perkins
Using ODP.Net with NHibernate and System.Decimal
A few months ago I wrote a question asking for solutions to this error. There were some good answers but none of them provided me with a work around that was database independent. At least something that would work with both Oracle and SQL Server. I was implementing some calculated fields in NHibernate and I […]
Read More →How to add a watermark to a textbox using WPF
Some time ago I had to implement a search box which filtered a result set in a DataGrid. It was a pretty straight forward exercise. However, it took some time to find a good example and change it into what I needed. Basically, what needs to be done is to add a TextBlock and a […]
Read More →Adding images to a Tree View in WPF using C#
Like I’ve said before, once you find what your looking for, it is wasy to find examples about how to use and implement it. I had this again while trying to add images to a treeview. The term I was looking for, while trying to find a solution was ValueConverter. In this solution I will […]
Read More →WPF DataGrid rendering is very slow
I was developing a WPF application that contained a DataGrid like so many times in the past. However, this time it was taking 20-30 seconds for the DataGrid to render. I checked the query execution speed. I was building the DataTable dynamically, but I checked the speed of that too and it was fast as […]
Read More →NHibernate MappingException association references unmapped class
During the mapping process you may encounter this error. In my situation the case was that I had the wrong namespace identified within the class attribute within a bag element containing a one-to-many element, like the below. <bag name=”Customer”> <key column=”CUST_ID” /> <one-to-many class=”CompanyName.SysName.Nhibernate.Common.Customer” /> </bag> Instead of Common I had another directory […]
Read More →NHibernate MappingException an association from the table refers to an unmapped class
When you are creating your mapping files for which NHibernate uses to know the data types and relationships of the data model, you are likely to receive this error message: An association from the table TABLENAME refers to an unmapped class: CLASS The is usually generated from the class.hbm.xml file within a many-to-one mapping where […]
Read More →NHibernate could not execute query[SQL: SQL not available] in C#
I was writing some new code that would use NHibernate a few days back and while I was testing it I received thie error: Could not execute query[SQL: SQL not available] The value xxx is not of type xxx.xxx.xxx and cannot be used in this generic collection. Parameter name: value de-DE: xxx ist kein Wert […]
Read More →Foreign Key constraint conflict Parent Child using NHibernate
This was a tough one. I got everything working just fine with the mappings and my classes, I even wrote some test code to check if the Parent Child data was being inserted ok. What I failed to do was create the FOREIGN KEY relationship between the Parent table and the Child table. Once I […]
Read More →Foreign Key is always 0 (zero) when inserting Parent Child using NHibernate
This one was a toughy. I searched for some time looking for examples about HOW TO: INSERT PARENT / CHILD RELATIONSHIPS using NHIBERNATE. What I found were these really cool looking object oriented AddChild methods, many-to-one and one-to-many mapping relationships. The thing about those examples is that they do not take into account legacy database […]
Read More →