Posted on 8/24/2009 9:37:14 PM by Justin Etheredge
I know that this post is going to be old hat for the vast majority of you, and if this is the case, then please just ignore this post. More than likely though, you’ve come across someone that needs to read this post, and if so please pass it on!
If you’ve been using C# 3.0 for long enough then you have probably started using a neat little piece of syntactic sugar called automatic properties.
Continue reading the rest of this post...
Posted on 8/21/2009 11:48:20 AM by Justin Etheredge
If you are a .NET developer then you are probably familiar with Reflector. For most developers it is an indispensible tool in their programming toolbox because it can often shed light on problems that you may be experiencing in your code. One thing that Reflector can do is to display the IL of a given class or method, and this can be useful, but if you are anything like me, then you don’t really want to stare at IL, you would much rather see a reflected version in the language of my choice. This can often expose issues because you can see all of the compiler generated types and have all of the syntactic sugar stripped away.
All this time though, I knew that there would be some very interesting translations and manipulations that occurred, but I didn’t really consider that the code which reflector spit out might not actually execute in the same way as the code that I was compiling. Well, today I found just that case (in the latest version of Reflector) while checking out this blog post.
Continue reading the rest of this post...
Posted on 8/19/2009 10:13:25 PM by Justin Etheredge
I was contacted today by a friend who was asking a very poignant question about using Moq in order to mock out a repository that uses expressions as finders. I don't think they were using them quite like we are going to use them below, but I'm generalizing the problem to a certain extent.
The Setup
So we will start off with a simple Person class that looks like this:
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
Then let's pretend that we have a repository with a "Find" method that looks like this:
public class PersonRepository: IPersonRepository
{
private PeopleContext context = new PeopleContext();
public IEnumerable<Person> Find(Expression<Func<Person,bool>> predicate)
{
return context.Where(predicate);
}
}
Continue reading the rest of this post...
Posted on 8/18/2009 7:15:47 PM by Justin Etheredge
Thanks to recent legislation passed by the United States Congress, many people in American are trading in their old run-down gas guzzling cars for much more fuel efficient vehicles. My wife's parents are taking advantage of this offer and they recently traded in an older Nissan car for a lean-mean fuel sipping vehicle. They really wanted us to come see the new car when we were over there Sunday evening, but unfortunately they were unable to take the vehicle home that evening because the dealership needed to "detail it". Not sure what you need to detail on a new car, but that is probably code for "we just got this one on the lot and had yet to put our dealership's logo on it".
But anyways, after we got over to their house we talked with them for a while and then my wife's mother brought out the brochure for the new vehicle that they were purchasing. They started going through the brochure showing us all of the cool little touches and features that the car they were getting contained. I was starting to get a little jealous! I found myself wanting things like a push button start and doors that unlock as I got near them. After going through the brochure, I was thinking, "Man, I want one of these!" But at the same time, this car was not one that I would ever be interested in or even consider purchasing, but this brochure just made the car seem soooooo sexy.
Continue reading the rest of this post...
Posted on 8/4/2009 10:59:45 PM by Justin Etheredge
Richmond Code Camp 2009.2 is just around the corner! It is coming up on Saturday October 3rd to be exact. We are going to hold it again over at J. Sargeant Reynolds Community College, which has an absolutely amazing facility for holding the code camp.
While the facilities are excellent, it can’t be any good at all unless we have some truly amazing speakers! And this is where you come in! If you have an idea for a talk, or you already have a few talks prepared, please submit them! We are going to close the speaker suggestions this Saturday (August 8th), so that we can let our speakers know what their slots are and what the schedule is. If you are so inclined, please blog, twitter, tell co-workers, etc… that they need to go here and submit a talk as soon as possible.
If you are new to giving talks (or have never ever given one), and are thinking about submitting, please feel free to contact me with any questions that you might have! I am happy to help in any way that I can.
If you aren’t going to submit a talk, then mark October 3rd on our calendar so that you are able to attend!