Tuesday, November 9, 2010

I've moved

I like the formatting capability of the site that's why. You can follow me here.

Thursday, February 11, 2010

Filtering EntityDataSource

Codes can be downloaded here.
Based on my experience, this one is a bit trickier than the LinqToSql counterpart I’ve explored. Whereas LinqToSql is error prone because it requires you to use .NET object within literals (bye bye Intellisense), Entity Framework (EF) is no different with its proprietary Entity SQL and other datatype nuances. To access the columns of a table, you need to use the it keyword. I still haven’t found the documentation (and rationale) behind this. I also found out that DateTime value needs special syntax in the form DATETIME’YYYY-MM-DD HH:mm’. The problem with this is that there is no DateTime.ToString() overload that spits out this format. I had to create an extension just for this. If you use TEXT in your table, prepare for the dreaded The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator error. This is very pesky but I was able to solve this by replacing text with varchar. Googling this error message yields a couple of discussion but none of them works for me unfortunately. Below is the filter-building logic part of the downloadable code.
image