December 3, 2010
If you’re attempting to return a LINQ to SQL object using a WCF service and are getting this error, what’s really happening is that .NET can’t serialize your object. This occurs when your LINQ to SQL objects contain circular references (example: customer points to an order, order points back to customer). To get around this, open your data context and in the properties window of the visual designer, set the “Serialzation Mode” option to “Unidirectional”. Thanks to Rick Stahl for his post on the subject.
–Adam
July 12, 2010
This is a particularly well-known error (see here, here, and here), but this is the second time that I’ve had to do a search on this error so I thought that I’d post it here so that I can find it more quickly. Anyway, when this error occurs, make sure that the NULL types in the LINQ dbml file match your SQL schema NULL types. Mismatches between the two seem to be a common cause of this error.
–Adam
June 9, 2010
If you’re having difficulties debugging a section of code that uses the SafeFileDialog.ShowDialog() method, the reason is that Silverlight requires that the ShowDialog() method be called from a user-generated action. For whatever reason, entering into debug mode makes Silverlight think that you are not responding to a user-action, even when you are. To work around this, simply place the breakpoint after you call the ShowDialog() method.
–Adam
June 3, 2010
Quick Tip: If you want to change the default layout script in your Zend Framework MVC application, you can do one of the following:
// Within controller
$this->_helper_layout->setLayout('other-layout') //other-layout.phtml
//Within view script
layout()->setLayout('other-layout'); ?>
Thanks to Andrew at the StackOverflow forums.
–Adam
May 31, 2010
In a current project that I’m working on, I needed to extend a UserControl to add some additional specialized functionality. This is very easy to do if all you need is to extend code, but it becomes much more difficult if you want to extend it via a XAML/C# UserControl. After much web searching, I found a very simple and elegant solution, thanks to this site. Basically, all you have to do is modify the root element of your extended file as follows:
<local:SomeBaseTypeYouWantToUse
x:Class="MyApp.MyControl"
xmlns:local="clr-namespace:NameSpace.To.Your.BaseClass"
/>
Where SomeBaseTypeYouWantToUse is the class that you’d like to extend. Simple!
–Adam
Update (6/3/2010):I ran into some weird problems with this hack that I was unable to resolve. If anyone ends up reading this, please let me know if this worked correctly for your application.