Josh-CO Dev

Solving the worlds problems one line of code at a time.


Leave a comment

C# Nullable datatypes – How to set a variable to accept nulls

This is a nifty little trick that I almost forgot about until today. Often times you need to pass a null value into a non-nullable datatype, such as an int. If you don’t know a trick, this can be pretty difficult. Here’s the trick:

int? varName;

Simple eh? Just add a question mark to the end of the datatype. This will force it to become a nullable datatype.

Advertisements


Leave a comment

Some LinqToSQL Samples to get you through the day

So, one of the things that I am learning from scratch with Silverlight is LinqToSQL. In my professional life, we are still using typed datasets to do all of our databinding and our restricted to WinForms and ASP.net. So this is all new to me. I have found the process to be incredibly simple and thought I would share some code.

Click past the jump for code.

Continue reading


Leave a comment

Silverlight WCF RIA Issues – Implement Domain Service

As i’ve mentioned in previous posts, I have been having some issues with WCF services in Silverlight. On my local computer, my application would compile and run just fine. When I would move the web service out to my host, GoDaddy, I would always get back errors that did not make any sense. I scoured the internet and found nothing of use. I have a clientaccesspolicy.xml, crossdomainpolicy.xml and did everything else the web told me. I then stumbled into some articles about using the entity framework with RIA calls, I am using LinqToSQL. These articles uses a domain services file to interface with the web service. I implemented this and everything began working. The weird thing is, so far it seems that I only need to expose the table itself through the domain service. I can still make all my web service calls, inserts, etc by calling my web service directly. Most frustrating problem ever!