I went a little nuts on this simple console program. I wanted to demonstrate different ways to use the Join operator with in-memory objects from a collection and pulling information from a database. In the process of wanting to leverage anonymous types in the query I was playing around with different ways to display the data. Do I just iterate thru the query and display it. Or do I take that data, create objects, and populate another collection type with the data. Again, your personal preference might be different. I was just playing around with what ways would work.
I broke the code up into different repositories for the in-memory data and database data. I also created a WriteResults method in an attempt to use a central class to display data. I know lots of work for a simple console program. However I think it shows some cool core concepts with LINQ queries.
You will notice that the one common class that’s the same from other examples is the Employee and Department classes along with their respective repository classes. I’ve added a couple more for the database data which I’ll go over below.