So, sometimes I feel like “how did I get myself here”.  If you pushed some buttons and didn’t realize you did something, you may find your directory view looks like the following:

image

Well, to clear it, all you have to do is put your cursor at the very bottom of the screen (below the last line, but not in the light blue area, then press the right mouse button.  You should get this:

(more…)

I’ve finally moved my Lenovo W500 over to Windows 7 RC.  What motivated me was my wireless networking was getting really really unstable.  Sometimes it would connect, other times it would not, and it never seemed to want to work at starbucks anymore.

So, here I am, and so far, vary happy.  I did try the Windows 7 beta and had some weirdness with Visual Studio 2008, but so far, everything has been perfect.  I do know the Microsoft folks have advertised that it contains better multi-monitor support.  I don’t know exactly what that means, but I have two monitors running off my Lenovo.  One is 2560×1600 and the other is 1600×1200.  One hassle I always had was moving a windows that was too big for the small monitor.  Now, I find that when I drag from the bigger to smaller, if the app is to big, it automatically get’s resized!  Nice Job MS!

(more…)

So, you have an enum defined as follows:

public enum CompanyAddressType
    {
        Unknown = 0,
        Primary = 1,
        Warehouse = 2,
        Distribution_Center = 3,
        Cross_Dock = 4
    }

You want to iterate through the list and put the data into an asp.net dropdownlist.

(more…)

We’ve built a data access layer on top of LINQ2SQL for dynamically building the layer we call for data access.  It’s convenient because we pass in a query object as a parameter that has a bunch of nullable variables in it.  Here is kind of what it looks like:

    public partial class CodeGenTestQuery : QueryBase
    {
        public int? Id { get; set; }
        public List<int> Ids { get; set; }
        public bool? IsStarred { get; set; }
        ...

If I pass an empty list of int’s into Ids, I have a line of code that build the query as follows:

(more…)

Last night, I had the honor of having dinner with three other VSLive speakers including Jim Wooley, one of the authors of the awesome book on LINQ titled LINQ in Action.  Jim is a wealth of knowledge as well as very entertaining.  He had an interesting analogy for what using try/catch statements to handle expected issues.  I’ll leave it up to you to post to his twitter account and find out what it was.  it’s just a little off color and I don’t want to be rejected from search engines.

(more…)

Today was my first time doing 2 presentations during the same day at a professional conference (VSLive, Las Vegas).  Both sessions were fun to present and hopefully the audience got as much out of it as I did.  Lots of great questions, several twitter posts and best of all, they both finished on time (that is, I finished the material at the time I meant to!).

Here is the material for the first presentation:

(more…)

*Note 10/22/2011 (2+ years later):  Microsoft is fixing this problem in EntityFramework 4.5!  See my post here about it: http://peterkellner.net/2011/10/22/microsoft-to-add-auto-compiled-linq-queries-to-entity-framework-v-next/

 

So, I’ve been on kind of a rant lately about how slow LINQ2SQL is if you don’t compile your queries before executing them.  To be fair, if you are doing Windows Forms Programming, WPF or Silverlight it really does not have much impact.  The reason is that a very complex LINQ query may take 50 milliseconds (1/20th of a second).  No big deal if you just have a dozen or so of them to do.  The story changes though if you are using LINQ2SQL in a web environment that has limited CPU resources.  That is, unless you have unlimited money, if it takes more than one web server to handle your load, your throwing away money by using uncompiled LINQ2SQL.

So, to put some more substance behind my claims, I’ve written a small test application using Visual Studio 2008 that compares the performance of using LINQ2SQL compiled verses non-compiled on a trivial web page.

(more…)

I’ve been doing a lot of LINQ2SQL lately and just in case I have not said it loud enough how enthusiastic I am about LINQPAD written by Joseph Albahari.  I have the $19 version which has intellisense, but even without, it would be totally awesome.

(more…)

So, I recently blogged about the huge penalty for not compiling your LINQ2SQL.  This problem is so big that it occurred to us that maybe all of LINQ has the problem.  So, time for a simple test.  Below is a very simple program that basically generates a list of Ids.  In one case, it’s using LINQ, and the other just Plain C#.  The code is pretty self explanatory.  Here are the results:

Test Performed Time to Do 100000 iterations
Using LINQ 52ms
Using Simple C# 35ms

Well, my fears are put aside.  Though LINQ is somewhat slower, for 100,000 iterations, .052 seconds is pretty good.  (compared with processing a single not to complicated LINQ2SQL statement for 100,000 iterations would take about 20,000 seconds or 333 hours.  Quite a difference to .052 seconds!

(more…)

So, this is very straight forward, but I sometimes forget it.  I figure I’ll do a short blog post on it so next time I search for it, I’ll probably hit my own blog post.

So, say you have a list of objects as follows:

(more…)

So, I’ve struggled some with this and did not have much help with searching.

Here is the problem.

You have a declaration that looks like this:

   1: public partial class CompanyQuery   {
   2:       public List<int> CompanyTypeIds { get; set; }
   3: }

Then, you need to figure out if CompanyTypeIds is populated using reflection.

(more…)

© 2012 PeterKellner.net. All Rights Reserved