Real World .NET, C#, and Silverlight

It took some time until I received my newest book, but now it’s here - Real World .NET, C#, and Silverlight – Indispensable Experiences from 15 MVPs:

Real World .NET, C#, and Silverlight: Indispensible Experiences from 15 MVPs (1118021967) cover image

With this book I’ve written just one chapter – as all the other authors did. Great content fairly partitioned across different topics from 15 MVPs. I’m giving you my summary what I’ve seen covered in this book.

ASP.NET and jQuery gives from David Giard gives some Information on new features from ASP.NET Web Forms 4.0, an introduction to ASP.NET MVC, and a glimpse into jQuery.

ASP.NET Performance from Bill Evjen is about state management, caching, performance counters, content delivery networks, compressions to get performance out of ASP.NET Web Form applications.

Ethical Hacking of ASP.NET from György Balássy is a chapter you should read to secure your Web site. With this chapter you get Information about tools such as Fiddler, Firebug, IE9 Developer Toolbar, Lens, how session management works, attacking ASP.NET authentication, CSRF attacks, attacking the ASP.NET session, view state hacking… and what you need to protect against attacks.

How to Build a Real World Silverlight 5 Application from Gill Cleeren gives a good introduction to SketchFlow before showing data binding features of Silverlight, using WCF RIA services, applying MVVM, and customizing of controls.

Silverlight – The Silver Lining for Line-of-Business Applications - Jeremy Likeness takes a different route to Silverlight.  He starts by giving an overview of the different Silverlight project types and explains the Interfaces  IApplicationService and IApplicationLifetimeAware to hook into startup, shutdown, and exception handling events. Next he compares MVC, MVP, and MVVM patterns, explains dependency injection and demonstrates how MEF can be used. In this chapter you can also read a comparision of MVVM Frameworks such as Prism, MVVM Light, nRoute, Calburn.Micro, and Jounce.

Tips and Tricks for Designers and Developers is a very short chapter from Daron Yöndem just covering 9 pages. This chapter mentions “importing assets from Photoshop”, “Using sample data for a better design experience”, “using behaviors to make things easier”. I just would hope to read more Information about importing from Photoshop, what are the issues, how can it be solved; sample data not only created from code with DesignerProperties.GetIsInDesignMode, but also Information about designer specifications in XAML, and much more Information on behaviors and not only two pages.

MVVM Patterns in Silverlight by Kevin Grossnicklaus is a big chapter again. It comes back to MVVM and explains how an MVVM Framework can be created. This chapter goes that far to build composite screens, displaying dialogs, and communication between views. In the last part of the chapter exisiting MVVM Frameworks Prism, MVVM Light, and Caliburn Micro are compared to each other.

Windows Phone “Mango” for Silverlight Developers from Alex Golesh goes into specific Windows Phone 7.5 issues and covers the Camera API, Sensors API, Silverlight/XNA Hybrid applications, using a local database, fast application switching (FAS), Background agents, notifications, contacts/appointments data access – things a Siverlight developer needs to now creating apps for the phone.

Pragmatic Services Communication with WCF is from Christian Weyer, a thinktecture colleague. As expected from Christian, this is a chapter of 63 pages (and this without security – this is in the next chapter). At the first page of this chapter Christian explains that this is not a beginner’s introduction – and not a full reference as well. It still starts with basics of WCF (ABC), but already adds some real world experience to the introduction (e.g barely using message contracts nowadays). Soon Christian steps into several topics such as validation, mapping, tracing, hosting services, sharing contracts, async calls, the Web programming model, and much more.

The next chapter is from another colleague at thinktecture: Dominick Baier – Securing WCF Services Using the Windows Identity Foundation (WIF). Dominick is the security specialist from thinktecture and gives a whirlwind tour through WCF security, claims-based identity, and federation. If you are knowledgeable of traditional security models like principals, identities, and roles, you should read this chapter to get the idea of security Tokens and claims. Dominick goes into the Windows Identity Foundation and explains the WCF security stack.

Chapter 11 from Jeffrey Juday is about Applied .NET Task Parallel Library. Jeffrey covers the .NET 4 library within 38 pages, both data parallelism as well as task parallelism using the Task class, showing exceptions, cancellation, and concurrent collection classes of .NET 4.

Vishwas Lele goes into Windows Workflow Foundation with the chapter The WF Programming Language. This chapter starts with a simple workflow, explains XAML in the focus of WF, explains several activities for control flow, exception handling, Transactions and compensation, parallel execution, and also explains how custom activities can be implemented. Hosting workflows and using persistence is explained as well.

My chapter has number 13 and is about Practical WPF Data Binding. Back to MVVM from previous chapters, but here I’m just using MVVM with a lot of data binding aspects. This chapter goes into various data binding concepts, showing multibinding, using the CollectionViewSource, implementing data templates, grouping, hierarchical data binding, virtualization, editing data, validation, error display…

Chapter 14 is the longest chapter over 79 pages. Driving Development with User Stories and BDD by Scott Millett. Scott gives a short introduction to user stories, explains the shortcomings of Test-Driven Development (TDD), and gets into the advantages of Behavior-Driven Development (BDD). Next, Scott introduces some BDD Frameworks before going into an application that is done with BDD in mind. User Stories are captured for the Tic-Tac-Toe game, and then BDD is used to until all behaviors of the application are implemented. Showing all the BDD aspects within a full application should be the best Approach to learn BDD.

The last chapter of the book is from Caleb Jenkins about Automated Unit Testing. Caleb introduces unit testing with the three A’s Assign, Act, Assert, covers various testing frameworks, explains Continuation Integration (CI) servers, talks about fakes and mocks, covers testing on using MVC, MVP, and MVVM…

As you can see, there is a lot what’s covered by this book. Silverlight, WPF, parallel programming, BDD, unit testing, security, WCF, WF, ASP.NET, hacking… Of course this is not a beginner’s book. However, I think nearly every .NET developer will find interesting Topics within this book – this is a must-read.


CN innovation

Real World .NET, C#, and Silverlight from

Real World .NET, C#, and Silvelright von

Hello, 2012

Early 2011 I blogged about my predictions on 2011. What were the things I blogged about the last year, was it becoming true? How does 2012 look like? The main topics my blog was about Silverlight 5, Windows Azure, Windows Phone 7, Windows 8, and HTML 5. Let’s have a look how my thoughts from early 2011 look like today, and what I think are the most important topics for 2012.

Silverlight 5

2011 (and earlier 2010) I blogged about the features of the upcoming coming Silverlight 5. In December 2011 it was finally released as is described here.

Now Silverlight 5 might not look as important as it was in the beginning of 2011. It’s not the tool of choice for writing platform-independent applications which is HTML 5 now. Silverlight applications cannot be used for Metro style apps with Windows 8. However, the traditional desktop of Windows 8 still is an important part to write applications for it for the next years to come. Looking into version 5, Silverlight received a lot of features important and helpful writing full desktop applications.

Silverlight 5 is supported by Microsoft until 10/12/2021, or through the support lifecycle of the underlying browsers, whichever is shorter. This should give enough time to give Silverlight the emphasis it needs to write new applications now. And the knowledge of XAML and C# can still be used with Metro apps in Windows 8.

Windows Azure

In 2011 I also blogged about new things coming with Windows Azure. Windows Azure still keeps growing, new features are added in a continuously basis. The cloud is becoming more and more important as the same data should be accessible from anywhere, no matter what device is used, and in some scenarios scalability can be solved by adding Windows Azure instances and just paying the instances needed.

New features recently added are support for Node.js, Hadoop-based Services, Federations, queues, topics, and relay services… More to come in 2012

Windows Phone

I also mentioned Windows Phone 7 with the Mango update to support copy and paste. The 7.5 update delivered a lot more great features as described in What’s new in Windows Phone 7.5. I really like this update and use the integration of Facebook Twitter, LinkedIn… a lot.

Currently Microsoft’s phone does not have the market presence it should have. I think this will change – and Nokia still has a lot of announcements to do to make Windows Phone more successful. It’s not the first time that Microsoft was a little late in the game but finally succeeded.

Windows 8

Early 2011 I already blogged about Windows 8 and expected a PDC for 2011 that should be a lot bigger than the 2010 PDC. This conference was a lot bigger, and still outsold just with the early bird bookings – and all this without posting an abstract of a single session before the conference. Just the name of the conference changed: Build Windows.

Although I was expecting a lot that was announced at this conference I was still surprised how well this all worked out and really like the new UI of the upcoming operating system. Applications to use the Metro UI can use XAML/C# or HTML5/JavaScript or XAML/C++. The choices are here. The application UI design must be done differently to be successful. Writing applications for Windows 8 I’m thinking a lot more about usability and how to change the workflow to be both easy to use and effective for the user.

Early 2012 (February?) I’m expecting the Beta version of Windows 8 and I’m already working now on several apps.

HTML 5 and JavaScript

Early 2011 I already mentioned HTML5 and already had several customers in 2011 to support them with HTML and JavaScript. HTML and JavaScript is making a comeback. jQuery helped a lot to make JavaScript programming more efficient.

I’m not only giving HTML5 and JavaScript an important place to create platform-independent applications to run on different mobiles and desktops but also think it’s a great option to write Metro style apps for Windows 8. For platform-independent HTML I'm using ASP.NET MVC that allows for great control of HTML and JavaScript.


For 2012 I’m also seeing a comeback for C++. C++11 gets cool improvements, and the support from Microsoft with Metro and XAML/C++ is here again. There are some applications that didn’t change the C++ code to .NET, and such libraries can now be really easy to use with new Metro style apps.

Of course C# gets cool improvements for async programming in 2012 that’s not less important. I’m working with C#, C++, and JavaScript in 2012.

I’m expecting 2012 to be an exciting year, expecting some new tablets that let Windows 8 shine, and put my big focus for the year on Windows 8 Metro, Windows Azure, HTML5, ASP.NET MVC, C++, C#, and JavaScript. Of course I’m also still doing WPF, Silverlight, and WCF, and writing about improvements on .NET 4.5. Already working on the next edition of Professional C# for several months now…


CN innovation

Developer Day am 29. November 2011 in Wien

Am 29. November startet auch heuer der Developer Day in Wien. Wie jedes mal geht es um aktuelle und zukünftige Technologien – diesmal steht Windows 8 und .NET 4.5 im Vordergrund.

C# 5 mit dem async keyword, Neuigkeiten zu .NET 4.5, News vom Windows Phone 7 und zu Windows Azure – und natürlich ein großer Einstieg zu Windows 8 mit Metro-Styles apps, der Windows Runtime, mit XAML und C#, HTML und JavaScript!

Weitere Infos:

See you there!


BASTA! 2011 Samples

Bei der Basta! 2011 in Mainz hatte ich gleich 4 Vorträge, und das zu unterschiedlichsten Themen. Die Slides und Samples zu meinen Vorträgen sind jetzt hier verfügbar!

Ich hoffe dass die Sessions gefallen haben! Have Fun!



CN innovation


Weitere Informationen zu diesen Themen bei meinen Workshops:

Web Futures Workshop

Windows Azure Workshop

C# Workshop

.NET User Group Austria–20. September 2011

Die .NET User Group Austria öffnet wieder! Der nächste Termin ist schon am 20. September 2011!

Einladung zur .NET User Group Austria
Dienstag, 20. September 2011
.NET User Group Austria
Global Knowledge
Gutheil Schoder Gasse 7a, 1101 Wien
Bitte um Anmeldung:
oder hier:!/event.php?eid=216030075117590

17:30 Zusammenkunft und Diskussionen
18:00 Präsentation von Christian Nagel zu Windows Azure Storage und neues zu Windows 8

Windows Azure Storage

Speichern von Daten im File-System, Kopieren von SQL-Express-Datenbanken in den Computing Account? Bei Windows Azure müssen die Daten anders behandelt werden. Dabei gibt es auch zahlreiche Möglichkeiten wie SQL Azure, Queues, Tables, Blobs. In dieser Session sehen Sie die Möglichkeiten für Storage in der Cloud, welche wann sinnvoll sind und wie sie eingesetzt werden können.

Außerdem gibt es Infos von der Build-Konferenz mit einem Blick auf Windows 8!


CN innovation

C# Future Directions

Thursday at Windows Build Anders Hejlsberg presented the future directions of C#. The new version number of C# is 5. The major features on this version are the integration of the Windows Runtime (WinRT) and of course the already well known async and await keywords for asynchronous programming. Anders also talked about some other cool features that I’ll introduce here.

Async Programming

The preview of the async features for C# v5 are out for some time now. I’ve already shown these keywords in a blog article from last year. Deeper information on this will follow in upcoming blog articles. Anders also talked about some other cool features that I’ll introduce here.

Great news at the conference is that the WinRT API offers async versions of the API if the function needs more than 15ms. This are 10-15% of the methods of the API. These APIs only offer async versions. Functionality like file I/O, network I/O…

And async methods have a big place in the .NET Framework as well. This makes it a lot easier to write async applications. And all applications should use this! The user interface must be very very responsive.

WinRT API asynchronous methods use IAsyncOperation<T>, .NET methods Task<T>, and JavaScript promises.

Windows Runtime

The Windows Runtime is written natively. It’s a new version of COM. Using namespaces, classes, constructors, statics, events… Using it from  C# feels very natural. Although it’s implemented natively it nearly cannot be differentiated from C# calling into managed methods. The Windows Runtime team took a lot of features from .NET and added it to the native Windows API.

It’s similar easy to create C# types that can be used from any language making use of WinRT, e.g. JavaScript. Interop is made easy, no longer [DllImport] and COM Interop attributes. Just create a public C# type that is sealed and restricted to the types of the WinRT (or types that are mapped automatically like collection interface types). The method GetMovies() returning IAsyncOperation<IList<Movie>> can be called directly from JavaScript. For Task<T> can be easily converted to IAsyncOperation<T>.

Caller Info Attributes

C++ allows changing the code line numbers and filenames with __LINE__ and __FILE__ macros. Macros are not possible in C# and never will be. However, this feature now made it into C# by using optional parameters. The attributes CallerFilePath, CallerLineNumber, and CallerMembername can be used with optional parameters. Thus it’s easy to change the line numbers like in C++ but without Macros.

Compiler as a Service – Codename Roslyn

Looking more into the future of C#, Anders introduced the current state of compiler as a service. Scenarios that are possible with this are meta-programming, read-eval-print loops, DSL embedding, accessing the complete language object model…

Anders showed how to copy C# code and paste it as Visual Basic, and the other way around. Refactoring a data class by implementing INotifyPropertyChanged to extend the properties automatically. A C# interactive Window where code can be added on the fly including intellisense and refactoring features.

I think this to be a big changer in the features available within Visual Studio and expect a lot of extensions not only from Microsoft but also coming from the community.

A CTP will be available In four weeks from now.


To summarize the most important parts: C# deeply supports the Windows Runtime, makes async programming really easy, hybrid C#/JavaScript applications are easy to do, and a CTP for Roslyn will be available soon.


CN innovation

Use what you know, do what you’ve always imagined

The first day of the //build/windows conference ended. We’ve seen an exciting keynote from Steven Sinofski. Windows 8 really rocks. Changing the world of computing.

Indeed, Windows 8 goes new ways from a usability standpoint. From the user interface there are many similarities with Windows Phone 7, but this is only the beginning. What’s similar is the integration of different calendars, photos from different places… Windows Phone 7 is a start how touch can be used with tiles, panorama… It’s really a start with WP7. Windows 8 extends this by a huge factor. Touch becomes great new possibilities. And this for a lot of different form factors. It was great to see that many different devices with different form factors on stage running Windows 8.

The new UI makes sense with every form factor. I’m happy using it on my big TV screen, to my workplace PC, notebooks, tablets, to the mobile phone. Probably on my big TV screen I prefer using Kinect gestures or touching a remote device instead of walking to the screen and touching it. Developing programs with Visual Studio I’m sure I will use the keyboard for a long time to go instead of using touch gestures and the on-screen keyboard. However, on the developer device touch is an important factor as well. Applications will be written with touch first. It looks like keyboard and mouse gestures are coming automatically using the Windows 8 controls. I really love touch on my slate-size devices and the mobile phone.

The new Windows API – Windows Runtime (WinRT) – that’s implemented native within the operating system is the new API to get to the features of the operating system. This API doesn’t look similar to the dated Windows API but more like the .NET Framework. It looks like a cleanup of the .NET Framework.

Use what you know

Before this event there was a rumor that new Metro style applications can only be written with HTML and JavaScript. I was never afraid of not using C# and XAML with Windows 8. With Microsoft different options always have been a possibility. It’s this time as well. Metro style apps can be done with C++, C#/VB, XAML, HTML, JavaScript…

.NET, WPF, and Silverlight developers still can use XAML, C#, and Visual Basic to create Metro style apps. Maybe it’s not Silverlight and not WPF. Silverlight had the code name WPF/E – no matter how it’s named now, it’s still XAML.

C++ becomes more important than it was in the previous years with features from the new C++ standards that can be used. In the code samples I’ve also seen some C++/CLI syntax to make use of the WinRT. I need to check into this. C++ with XAML.

And of course HTML/CSS and JavaScript. The big advantage here is that there are a lot more JavaScript developers worldwide than there are .NET developers. Now all the JavaScript developers can become Windows developers, and by adding just a few lines of WinRT code the application becomes bound to Windows gets a great integration and nice features.

Do what you’ve always imagined

I don’t know if that’s what we’ve imagined to do, but Windows 8 looks like a bright way to go. In the old days of computing applications made some things possible. That’s not enough anymore. Now it’s necessary to make things easy for the user. This is where the Metro style shines. Some of the attributes that should be supported by metro style applications are fast and fluid, snap and scale, contracts for communication between applications, alive tiles… I will blog more about this later.

Windows 8 also gets an app store. Metro style applications that are installed from this store roam with the user, no matter on what system he’s logging in. The app store will also be available for old Win32 applications that then can be found more easily. For these applications the app store just offers a listing, and the store gets the advantage that immediately thousands of applications can be available.

The cloud plays an important part with Windows 8. Not only with the app store, but all application settings can be stored in the cloud. A user no longer needs to configure application settings with every system.

I’ve already tried some apps and started writing Windows 8 metro style applications on my new Samsung. It’s really exciting, the future is Metro.

More information coming soon.


CN innovation

jQuery und ASP.NET MVC Workshops

19. September und 20.-21. September gibt es in Kooperation mit Global Knowledge offene Kurse zu jQuery und ASP.NET MVC in Wien:


Rasant erobert jQuery Web-Applikationen. jQuery ist u.a. bei Amazon, Twitter, Dell, IBM im Einsatz. Bei Microsoft Tools ist jQuery bereits Bestandteil von Web Applikations-Templates Visual Studio. Für Visual Studio wird dabei gleich integrierte Dokumentation angeboten.

Dass jQuery die Web-Welt im Sturm erobert hat auch seinen Grund. Mit jQuery geht es ein vielfaches einfacher als nur mit JavaScript Web-Seiten zu gestalten, manipulieren, und zu animieren. Und dabei ist Browser-Unabhängigkeit gleich integriert.

In diesem Workshop gibt es einen 1-Tages Einstieg zu jQuery, Selectors, DOM, Animationen, jQuery Utility Funktionen, und auch einen Einstieg in jQuery UI. Kenntnisse von JavaScript sind vorteilhaft.


ASP.NET Web Forms oder ASP.NET MVC? Nach 10 Jahren ASP.NET Web Forms ist es Zeit für eine neue Technologie, wobei ASP.NET Web Forms sicher nicht obsolete ist. Hier haben wir zwei unterschiedliche Herangehensweisen an die Programmierung von Web Applikationen. Während es bei ASP.NET Web Forms die Zielsetzung gibt dass der Entwickler Web Applikationen möglichst ähnlich zu Windows Forms programmieren können soll, Methoden und Properties von (server-seitigen) Controls verwendet die den Windows Forms controls möglichst ähnlich sind, und HTML sowie JavaScript nicht anzugreifen braucht (was sich dann aber oft doch anders herausstellt), gibt es bei ASP.NET MVC eine konträre Zielsetzung. HTML und JavaScript (siehe auch jQuery) haben in ihrer Bedeutung wieder gewonnen, mehr Kontrolle über HTML ist oft wünschenswert. Mit C# wird server-seitige Funktionalität programmiert. Mit der Struktur die von ASP.NET MVC vorgegeben wird ist es auch gleich viel einfacher Unit Tests für die Applikation zu erstellen.

In diesem 2-Tages Workshop gibt es einen Einstieg in ASP.NET MVC 3, mit Controllers, Views, Routing, Razor und vieles mehr.

Für den 19. und 20.-21. September gibt es noch ein paar freie Plätze. Bei Interesse bitte kontaktieren.  Firmenworkshops sind natürlich auch möglich.


CN innovation

Mehr Informationen zu meinen Web-Workshops

Taking advantage of Windows 7 with Web Pages

The Windows 7 taskbar is one of the great improvements of Windows 7. Users can pin applications to the taskbar so the application is fast accessible. The application need not to run, the application is accessible with the click of a button and thus replaces the quick launch. With the task bar the application can also offer some tasks that can be accessed from the user directly, instead of starting the application first and accessing the specific feature of the application. The .NET 4 version of WPF got an improvement that integrating the application with the task bar becomes an easy task. Starting with IE9, this is also an easy task to do with Web applications as this article demonstrates.

First, I’m adding a custom icon to the Web application. This icon is shown with IE9 in the taskbar and with the address link as the following figure shows.


If the Web application is pinned to the taskbar, the icon is displayed on the left side as well, and the back and forward buttons are colored. There’s a way to specify the color of the back and forward buttons. If the color is not specified, the color is taken automatically from the icon.


The icon can be specified in the header section of the HTML page with a link to an icon as shown. The meta elements named application-name, msapplication-tooltip, msapplication-starturl, and msapplication-window are used to configure the settings for the taskbar.

<link href="/Content/Icons/favicon.ico" rel="Shortcut Icon" type="image/x-icon"/> <meta content="CN innovation" name="application-name" /> <meta content="Information about CN innovation" name="msapplication-tooltip" /> <meta content="" name="msapplication-starturl" /> <meta content="width=1024;height=768" name="msapplication-window" />

Selecting the context menu of the application pinned to the taskbar you can see information about the application as well as some links for fast access as the figure below demonstrates. This is the jump list.

The icon of the application is shown in the lowest section above the unpin and close options. These options as well as the menu to start in private browsing cannot be changed with IE9. The name of the application that was set with the application-name meta tag is shown beside the icon. With the application here I’ve also added two tasks for fast access which are Training and Books, and a custom section that lists the latest blog entries. How this is done is shown next.


Adding tasks to the task list is just a matter of adding meta tags msapplication-task. The content of this tag lists the name that is shown in the jump list, the link that should be opened on activating the item, and the icon.

<meta content="name=Training;action-uri=;icon-uri=/Content/Icons/training.ico" name="msapplication-task" /> <meta content="name=Books;action-uri=;icon-uri=/Content/Icons/books.ico" name="msapplication-task" />

The items that should appear above the task list can have custom section names. I’ve created a Blog section and display titles of the last five blog entries that link to these. Adding such items to the jump list is done with JavaScript. First it is verified if the Window is pinned. This can be done with the function window.external.msIsSiteMode. If it is not, and if the site is opened from a different browser, the script doesn’t need to run. A new section is created with the function msSiteModeCreateJumpList. Items to the jump list are added with msSiteModeAddJumpListItem. The parameters of this method are the name that should be displayed with the jump list, the URL that should be opened, and the link to the icon that should be displayed.

<script type="text/javascript"> try { if (window.external.msIsSiteMode()) { ext = window.external; ext.msSiteModeClearJumpList(); ext.msSiteModeCreateJumpList("Blog"); ext.msSiteModeAddJumpListItem("Sharing Assemblies between Silverlight and .NET", "", "/Content/Icons/blog.ico"); ext.msSiteModeAddJumpListItem("Real World .NET 4 and C#", "", "/Content/Icons/blog.ico"); ext.msSiteModeAddJumpListItem("BASTA! 2011 in Mainz", "", "/Content/Icons/blog.ico"); ext.msSiteModeAddJumpListItem("WPF ListBox Postioning using a Canvas", "", "/Content/Icons/blog.ico"); ext.msSiteModeAddJumpListItem("Reserve the date! Developer Day 2011", "", "/Content/Icons/blog.ico"); ext.msSiteModeShowJumpList(); } } catch (exception) { } </script>
In my site the JavaScript function is created dynamically by using server-side ASP.NET code to create items that reference the last five blog entries.

It will be interesting to see what features Web applications will get from Windows 8. This taskbar feature from Windows 7 is limited in the way that there is not enough place for all my important applications. Let’s see how Windows 8 changes this using Metro, and what other features Web applications can use from Windows 8.


CN innovation

How to use WPF 4 to integrate in the Windows 7 taskbar is shown in my book Professional C# 4 and .NET 4.

Information on programming Web applications in my Web programming workshop.