Author: Peter Vogel

Dynamically Accessing Large Resource Files in XAML at Runtime

WPF provides ResourceDictionaries as a convenient way of adding resources like Styles to your application to be accessed when needed. However, if a non-executable resource gets very large and/or is used infrequently, resource files are a better choice than ResourceDictionairies. With WPF applications you can incorporate any non-executable resources (including data files, images, audio, and […]

Integrating Your Own Code with Entity Framework: The Factory

In my last post, I showed how to use the code-first technology in Entity Framework 4.1 to create your business entity classes and integrate them into EF. I’ll complete that code-first process in this post and add a warning about a limitation in the process compared to Entity Framework’s original data-first process. After defining your […]

Integrate Your Own Code with Entity Framework: The Business Entities

While Microsoft’s Partial Classes and Partial Methods let you extend the classes generated for you by Entity Framework, in the end you’re working with someone else’s code (albeit, code that is, effectively, written for you by the ADO.NET team). But with Entity Framework 4.1‘s code-first technology you can write your own classes and have EF […]

Prevent Cross-Site Scripting Attacks with Microsoft’s AntiXSS

Cross-site scripting (XSS) is a frequent way that hackers attack sites (Symantec estimated that, in 2007, cross-site scripting accounted for 80% of all documented site vulnerabilities), surpassing even buffer overflows as the most commonly reported vulnerability. The goal of XSS is to insert malicious scripts into Web pages in order to access cookies or to […]

Precompiling LINQ Queries in .NET Framework 4.5

While it is possible to precompile LINQ queries for Entity Framework either to have your queries run faster (either without parameters or with parameters) or to run your queries on a background thread, in .NET Framework 3.5/4, it’s neither pretty nor fun. The code isn’t particularly ugly but it does require some additional effort for […]