Tag Archives: Auto-Generation

Quick Tip: Decrementing IDENTITY Column

Did you know that IDENTITY columns can count downward?! According to MSDN, IDENTITY’s second argument, named increment, “is the incremental value that is added to the identity value of the previous row that was loaded.” No constraint is given that increment must be positive (remember from Algebra that both positive and negative numbers can be added). Set increment to a negative number and IDENTITY will generate a descending sequence of numbers. Continue reading

INotifyPropertyChanged – propertyName – Past, Present and Hopes for the Future

Raising an INotifyPropertyChanged event requires a string containing the affected property’s name. Developers want a simple, clean and performance-efficient way to populate this string. New versions of .Net have brought developers closer and closer to achieving this goal.

Let’s review how INotifyPropertyChanged implementation options have improved over the years. Then, let’s consider an idea on how these options might be made even better. Continue reading

How is a WPF XAML file tied into the application’s executable environment?

By hidden source code file…

A hidden source code file is auto-generated for each WPF XAML file. The names used for this file and for the class it contains are based off the XAML file’s filename. In a C# application, the file MyWindow.xaml will have a hidden code-behind file named MyWindow.g.cs containing a class named MyWindow.

…containing a class…

The contained class inherits from the WPF core class corresponding to the associated XAML file’s root element. If the root element in the XAML file is <Window>, the class in the hidden code-behind file will inherit from Window.

Continue reading

WPF, Where Is Your “static Main()” Method?

The typical WPF application—as viewed in Solution Explorer—consists primarily of XAML files (.xaml) paired with code-behind files (.xaml.cs) and ordinary source code files (.cs). None of these files contains a static Main() method—the starting point of execution in a C# program. Where then does execution begin in a C#.Net WPF application?

Continue reading