Site: http://www.paulstovell.com/blog Link: http://feeds.feedburner.com/PaulStovell
by Paul Stovell via Paul Stovell on 6/5/2011 2:00:00 PM
A few weeks ago I posted some screenshots of an application I'm working on. A few people guessed, rightly, that it is a tool for automated deployment. Progress is going well, so I'd like to share some more details, and get your feedback. Octopus is a automated deployment solution for .NET applications, powered by NuGet and designed for convention over configuration. Deploy Web applications and Windows Services Configure your applications automatically Works inside your network or over the ...
[ read more ]
by Paul Stovell via Paul Stovell on 6/1/2011 2:00:00 PM
So the rumors are true. Windows 8, from the bootloader to the composition engine, is going to be completely rewritten in HTML 5 and JavaScript: Today, we also talked a bit about how developers will build apps for the new system. Windows 8 apps use the power of HTML5, tapping into the native capabilities of Windows using standard JavaScript and HTML to deliver new kinds of experiences. These new Windows 8 apps are full-screen and touch-optimized, and they easily integrate with the capabi ...
by Paul Stovell via Paul Stovell on 5/3/2011 2:00:00 PM
Sunday, 8th of May marks five years at Readify for me. This week I am reflecting on the things I have learnt and the experiences I have had. On the bus home tonight, I did some thinking about some of the things I've learned over the years. Communication, communication, communication I learned how important it is to keep my client/team up to date with what I'm up to. It's important to let them know when I am blocked, and also when I accomplish something. Communication is the only "hammer" tha ...
by Paul Stovell via Paul Stovell on 4/27/2011 2:00:00 PM
"Coupling", in code, is usually described as loose or tight, and is a way of measuring how dependent one piece of code is on another piece. In integration, we talk about coupling between systems. But it's not as simple as loose and tight; there are many different kinds of coupling between systems, and that's the topic of this post. When choosing an integration approach, coupling can be measured along many dimensions: Semantic Application 1 understands a "Customer" as someone with an active, ...
by Paul Stovell via Paul Stovell on 4/26/2011 2:00:00 PM
We have been exploring ways to share customer information between these two applications: The solutions we've covered so far are: Shared database Extract/transform/load Web services (RPC/REST) Web services are a nice way to decouple the applications, because they allow the applications to define and share a contract rather than taking a dependency on implementation details. But they do introduce other forms of coupling, especially around reliability. Messaging Messaging allows the appl ...
by Paul Stovell via Paul Stovell on 4/25/2011 2:00:00 PM
We've been looking at ways to share customer information between two applications: One approach was having both applications use the same OLTP database. This presented some challenges; namely, it coupled the two applications very closely together, creating a huge ripple effect if either application needed to change. A second solution was to use ETL scripts to shift data between application databases. This decouples the applications a little, but integrating at the data layer means we lose a l ...
by Paul Stovell via Paul Stovell on 4/23/2011 2:00:00 PM
As I outlined previously, we need to enable these two applications to share customer data: A few people suggested having both applications share the same database, but that has some pitfalls. In coupling both applications to the same database, the ripple effect of change will become hard to manage over time. A second solution, as suggested by Robert and Peter in the comments, is for each application to "own" an independent database, and to use an extract, transform and load process to push ...
by Paul Stovell via Paul Stovell on 4/21/2011 2:00:00 PM
In my last post, I introduced a scenario where we need to allow two applications to make use of the same customer information: The Web Store already has a SQL Server database. Since we're still designing the Marketing application, we could just make it use the same database. The result would look like this: This is probably the simplest solution that could possibly work, but it has a few downsides: Since changes to the schema could affect the other team, changes need to be co-ordinated. ...
by Paul Stovell via Paul Stovell on 4/5/2011 2:00:00 PM
At Readify we focus on the Microsoft stack - WPF, Silverlight, and ASP.NET. The bulk of our projects are ASP.NET, some are Silverlight, and even less are WPF (though the WPF projects tend to be bigger in scope, so they're probably about even). Usually the customer has decided on a technology stack before we arrive, and they've engaged us to help plan/design/build/ship the application. Sometimes it's too late to suggest technology changes, but other times we can influence the technology they dec ...
by Paul Stovell via Paul Stovell on 4/4/2011 2:00:00 PM
Friend and colleage Nick Blumhardt will be running a course on Inversion of Control in May this year. Nick is known for building a popular IOC container. He's also put a lot of thought into the role of IOC containers in projects, and I consider him a major thought leader in the space. As an example, many IOC containers have supported the ability to resolve an array of dependencies, or to inject a Func<T>. Nick put a lot more thought into this, defining what he calls the "relationship z ...
by Paul Stovell via Paul Stovell on 4/2/2011 2:00:00 PM
I just answered a question on StackOverflow, where my answer involved using named controls in a ControlTemplate. It occurred to me that many WPF developers might not be aware of the feature, even though they've probably used it before. Suppose you're an intern at Microsoft, and you've been told to implement the TextBox feature for WPF. It's complicated: You need to handle selection of text, including commands like Ctrl+A You need to handle copy/paste You need to handle multiple languages and ...
by Paul Stovell via Paul Stovell on 2/15/2011 2:00:00 PM
When it comes to dealing with databases, smart .NET developers follow the unit of work pattern. In NHibernate, the unit of work is an ISession. In LINQ to SQL and Entity Framework, it's the DataContext/DbContext. When implementing a unit of work, or in fact any object, lifetime matters. When is the unit of work created? When does it end? When writing ASP.NET or WCF applications, the lifetime of a unit of work is usually the request/response cycle. A single ASP.NET MVC controller might touch ...
by Paul Stovell via Paul Stovell on 2/6/2011 2:00:00 PM
Here's the configuration file of an application I'm working on: <?xml version="1.0"?> <configuration> <appSettings> <add key="Repositories.ConnectionString" value="Server=(local)\SQLEXPRESS;Database=XYZ;Trusted_connection=true;"/> <add key="Email.Pop3Host" value="pop.gmail.com"/> <add key="Email.Pop3Port" value="995"/> <add key="Email.Pop3Ssl" value="True"/> <add key="Email.Pop3User" value="someone@gmail.com"/> <add k ...
by Paul Stovell via Paul Stovell on 1/30/2011 2:00:00 PM
I just released an open source library called DbUp, which embodies some of the goals I talked about in my how to deploy a database article. The code and an overview is available on Google Code Binaries are available on Google Code Downloads Join the DbUp Discuss Google Group Get the NuGet package The sample application included in the code shows how the API works. ...
by Paul Stovell via Paul Stovell on 1/10/2011 2:00:00 PM
Managing dependencies in .NET can be painful. You download the latest version of NServiceBus, only to find that it uses an old version of Castle Windsor, which isn't compatibile with the new version of Windsor that you need for Caliburn. Package managers like OpenWrap and NuGet attempt to solve this problem, but they don't. Unless the NServiceBus team (or someone else) releases a new version of NServiceBus for the latest Castle Windsor, you're out of luck. Personally, I like the way NDesk.Op ...
by Paul Stovell via Paul Stovell on 1/2/2011 2:00:00 PM
I'm still experimenting with building games, and one of my projects is a little client/server game. Rather than using WCF and dealing with the leaky abstractions, I decided to write something small and custom. Pigeon is an alternative to WCF designed for high throughput. It uses raw TCP sockets It uses Google Protocol Buffers to keep messages small It is asynchronous The code is on BitBucket On my local machine, WCF NetTcpBinding maxes out at about 10,000 messages/second, while Pigeon ach ...
by Paul Stovell via Paul Stovell on 11/24/2010 2:00:00 PM
When I'm building an application that stores data, there are a few things I try to make sure we can do when it comes to managing the lifecycle of our storage. I'm going to focus on SQL Server, but this applies to other relational storage. What's in a database? Even outside of production, a database is more than schema. A database "definition" consists of: The database schema (tables, views, procedures, schemas) Reference data (ZIP codes, salutations, other things I expect to always "be ther ...
by Paul Stovell via Paul Stovell on 11/1/2010 2:43:05 AM
Since PDC there's been some discussion about the future of Silverlight vs. HTML 5: Via: Our strategy with Silverlight has shifted (Mary Jo Foley) But when it comes to touting Silverlight as Microsoft’s vehicle for delivering a cross-platform runtime, “our strategy has shifted,” Muglia told me. Silverlight will continue to be a cross-platform solution, working on a variety of operating system/browser platforms, going forward, he said. “But HTML is the only true cross pl ...
by Paul Stovell via Paul Stovell on 10/28/2010 9:35:56 AM
From a user's point of view, OpenID works something like this: You browse to a site you like that uses OpenID, and click the "login" button You enter your OpenID You are redirected to the site that authenticates your OpenID. Note: You may be asked to login with a username and password for that site if you haven't done so recently. You are redirected back to the original site you browsed to, and are automatically logged in Today I got to thinking that this is quite similar to how the "reset ...
by Paul Stovell via Paul Stovell on 9/6/2010 11:06:32 AM
In May I gave a rough idea of where Magellan 2.0 was heading. This weekend I decided to call it "done" and checked in the final 2.0 binaries. Let's look at what's new in Magellan 2.0. Project Hosting and Discussion Previously I was using my blog for Magellan documentation, and CodePlex for the source/binaries. Before 2.0, I decided to shift everything to Google Code. The source is now hosted in Google Code's Mercurial server. There's also a discussion group you can join if you have problems ...
by Paul Stovell via Paul Stovell on 8/5/2010 1:42:09 PM
I just released some source on Google Code called Observal: http://code.google.com/p/observal/ Observal was extracted from work on a recent WPF project. In our application, we had a deep hierarchy of view model objects, with some very complicated interrelationships - setting one property over here means adding or removing items from a collection over there - and since WPF applications are so stateful, we had to do it all reactively. The project home page gives a simple example of how Observa ...
by Paul Stovell via Paul Stovell on 7/1/2010 11:36:52 AM
A good rule of thumb to live by is that long-lived objects should avoid referencing short-lived objects. The reason for this is that the .NET garbage collector uses a mark and sweep algorithm to detemine if it can delete and reclaim an object. If it determines that a long-lived object should be kept alive (because you are using it, or because it's in a static field somewhere), it also assumes anything it references is being kept alive. Conversely, going the other way is fine - a short-lived ...
by Paul Stovell via Paul Stovell on 5/31/2010 3:10:23 PM
If you have been following the Magellan change log, you might have seen some pretty big changes go through recently. I'm preparing for a Magellan 2.0 preview release with some pretty significant features, which also require some design changes. Rethinking Magellan Previously, Magellan was all about the MVC pattern, taking the learnings from ASP.NET MVC and applying them to WPF. Magellan 2.0 builds around that, creating a new layer that makes Magellan a general navigation fra ...
by Paul Stovell via Paul Stovell on 5/2/2010 12:27:40 PM
This week I have been working on a routing system for Magellan. The goal was to make it very similar to ASP.NET's style of routing: Routes.Register("Default", "{controller}/{action}/{id}", // Path specification new { controller = "Home", action = "Index", id = "" }, // Defaults new { id = "^[0-9]+$" } // Constraints ); Unfortunately, I hadn't counted on Silverlight's security implementation. Since anon ...
by Paul Stovell via Paul Stovell on 2/20/2010 6:42:47 AM
The latest CodePlex Magellan build includes a couple of changes that are worth noting: The new Forms controls No need to import the Magellan namespaces Various bug fixes That second item is worth focusing on. In previous builds, to use any of the Magellan classes in XAML, you had to write: <Page ... xmlns:magellan="http://xamlforge.com/magellan" > <magellan:Layout... I wrote before about an idea to move them to the default XAML namespace, and while a ...
by Paul Stovell via Paul Stovell on 2/20/2010 6:31:11 AM
Back to: Magellan Home Data entry forms are common in line of business WPF applications, and they can become repetitive to write. Magellan includes a new set of controls that you can use to rapidly throw data entry forms together. The goals of Magellan Forms are: Minimal XAML Abstract presentation concerns Use conventions to infer as much information as possible Flexible and extensible Getting Started To illustrate, take a form declared like this: <Form> < ...
by Paul Stovell via Paul Stovell on 1/26/2010 7:04:16 AM
I have migrated the Magellan source code and releases to CodePlex. http://magellan.codeplex.com A few benefits to using CodePlex are: I use TeamCity to publish releases for each check in (thanks to the MSBuild Deployment Tools project). The releases are hidden at first (in case they have problems) and once I have tested them they become public. You can use the RSS feed to stay up to date. You can use the Issue Tracker to report bugs. You can use the online source code b ...
by Paul Stovell via Paul Stovell on 1/15/2010 6:18:52 AM
It seems that every WPF developer has written a Model-View-ViewModel library, and I was starting to feel left out. Having written an MVC and MVP framework, I figured I may as well write an MVVM library. But I want it to be different - I want the ViewModels to be as small as possible. That's how MicroModels was born. MicroModels is inspired by Fluent NHibernate and uses TypeDescriptors to dynamically define properties, collections and commands. In the example below, the view ...
by Paul Stovell via Paul Stovell on 1/14/2010 9:33:02 AM
I have seen some confusion around the naming of the major UI presentation patterns, often with code being described as one pattern when actually it uses a different one. This usually happens because the goals behind each pattern are similar and the descriptions are a little too theoretical. I want this page to serve as a practical description of each pattern and to provide some concrete examples of what differentiates the patterns in the wild. The Three Major UI Patterns The ...
by Paul Stovell via Paul Stovell on 1/11/2010 10:09:41 AM
I have owned a copy of Sams Teach Yourself WPF in 24 Hours for about a year, and I still find it an interesting book. One thing I like about this book is that doesn't just show off WPF features - it shows how to use the Model-View-Presenter pattern in doing so. The book was written by Rob Eisenberg and Christopher Bennage from BlueSpire, who are also the guys behind the Caliburn WPF framework, so they know a thing or two about the Model-View-Presenter pattern. Like the Model- ...
by Paul Stovell via Paul Stovell on 12/30/2009 5:15:03 AM
Back to: Magellan Home Magellan 1.1 brings support for asynchronous controllers. First we'll look at what it enables, then I will show some ways to configure it. The controller action below makes a WCF call to load a list of customers, which are used as the model for the view. This service call could take some time to evaluate: public class CustomerController : Controller { public ActionResult List() { Model = CustomerService.GetCustomers(); return P ...
by Paul Stovell via Paul Stovell on 12/22/2009 1:09:19 AM
Back to: Magellan Home Magellan does not natively support Windows Forms, but adding support is as easy as writing your own View Engine. As described in the documentation on View Engines, there are two classes we need to write. The first is an object that implements IViewEngine, which is responsible for finding the view. The second is an object inheriting from ViewEngineResult, which contains logic for rendering the form (i.e., calling Form.Show()). There are also a couple ...
by Paul Stovell via Paul Stovell on 12/21/2009 2:21:54 PM
Back to: Magellan Home Magellan is all about navigation, an important part of which is showing views. In Magellan, a view can be a Window, Dialog or Page. With the Composite WPF extension, a view can also be any user control that can be added to a Region. The system is also extensible - see the page on Windows Forms support for an example on writing your own view engine. View Results As described previously, controller actions return an Action Results. These contain the logi ...
by Paul Stovell via Paul Stovell on 12/14/2009 4:05:33 AM
Back to: Magellan Home Because the Magellan framework handles many parts of the navigation lifecycle, there are a number of things that can go wrong. I want to dedicate this page to explaining the common exceptions that are thrown by Magellan, and look at techniques for handling them. Exceptions thrown by Magellan Where logical, Magellan throws standard .NET exceptions such as ArgumentNullException and InvalidOperationException. However, Magellan also has it's own set of cu ...
by Paul Stovell via Paul Stovell on 12/12/2009 11:24:08 AM
Back to: Magellan Home Action Results are a concept from ASP.NET MVC and other MVC frameworks, and they are also supported by Magellan. They provide a powerful mechanism for decoupling the controller from UI specific concerns. Before discussing how they work, we should discuss why they exist. Why Action Results? Suppose you weren't using Magellan and you had an action like this: public void Login(string username, string password) { var window = IsValidLogin(username, p ...
by Paul Stovell via Paul Stovell on 12/12/2009 10:08:02 AM
Back to: Magellan Home When navigating between pages, transitional animation can provide a powerful means of communicating context with the user. The Transitionals library from Microsoft is a popular way to set up transitions when content changes, and comes with a number of out of the box transitions such as 3D cube, blinds, dissolve and star wipe. When it comes to page navigation, we often want transitions to relate to the navigation we are performing. For example, if we cl ...
by Paul Stovell via Paul Stovell on 12/7/2009 1:44:07 PM
I just added a page on Magellan Action Filters. One of the reasons I'm excited about this is that action filters and view filters will allow me to handle a common and complicated issue - re-activating an existing view. Take a controller action like this: public ActionResult Show(int customerId) { var customer = Customers.Find(customerId); Model = new CustomerDetailsModel(customer); return Window("CustomerDetails"); } If you clicked a pair of customers in a ...
by Paul Stovell via Paul Stovell on 12/7/2009 1:33:21 PM
Back to: Magellan Home Action Filters are typically attributes that you can apply to a Magellan controller or controller action in order to intercept the call and provide an alternative way of handling the request. They provide a poor man's Aspect Oriented Programming mechanism for controllers. Action Filters The sample below shows how an Action Filter might be used. The Log attribute can be applied to either methods or classes: public class MyController : Controller { ...
by Paul Stovell via Paul Stovell on 11/26/2009 2:57:34 PM
Progress on Magellan has been a little slow this week as I have been experimenting with some ways to optimize memory usage when dealing with WPF pages. A lot of it comes down to issues with WPF's navigation system and some of the limitations it has. The major problem we encounter when using WPF Page objects is that if you were to do something like this: NavigationService.Navigate(new MyPage()); You just got yourself an object that will never be garbage collected. This ha ...
by Paul Stovell via Paul Stovell on 11/15/2009 9:40:50 AM
Back to: Magellan Home Magellan now comes with a Visual Studio Project Template that you can use to get started with quickly. You will need Visual Studio 2008. Magellan-Setup.msi Setup The installer will guide you through the installation process. During installation it will also register the Visual Studio project templates. If Visual Studio is already running, your will be prompted to close it at this time. Once the installer finishes, your installation directory wil ...
by Paul Stovell via Paul Stovell on 11/13/2009 7:13:39 AM
Back to: Magellan Home The MVVM Light Toolkit is an MVVM framework by WPF MVP Laurent Bugnion, the author of Silverlight 2 Unleashed. It works well alongside Magellan and makes it easy to put behaviors behind views. The integration model with Magellan is quite similar to using the Microsoft MVVM toolkit. One difference is that the MVVM Light Toolkit typically uses resources to refer to the ViewModel, limiting the amount of code behind that is required. Since Magellan control ...
by Paul Stovell via Paul Stovell on 11/12/2009 10:11:38 AM
Back to: Magellan Home As an MVC framework, controllers are the most prominent object in Magellan. At their simplest, controllers are implemented as classes, and actions are implemented as methods on the class. Actions on a controller must be public methods, and must return ActionResult objects. Here is an example: public class CustomerController : Controller { public ActionResult Index() { Model = Customers.GetAll(); return Page(); } public A ...
by Paul Stovell via Paul Stovell on 11/11/2009 6:38:49 AM
Back to: Magellan Home Magellan's MVC framework is designed to handle navigation between views. However, the views themselves, and how they are implemented, is outside of Magellan's concern. Views can be simple XAML pages, or they can be driven by an MVVM or MVP pattern, or any other way you might like. Microsoft provide a Visual Studio project template known as the MVVM Toolkit, which makes it easy to get started using the MVVM pattern. To use Magellan with the MVVM toolk ...
by Paul Stovell via Paul Stovell on 11/10/2009 1:07:43 PM
Back to: Magellan Home Magellan was designed to work with Composite WPF from day one. Composite WPF provides support for multiple modules, loosely coupled pub/sub eventing, and regions for sub-dividing zones in the UI. However, Composite WPF does not enforce any particular UI pattern - MVVM, MVP and MVC could all work. Magellan and Composite WPF can work well together to create a composite navigation-oriented application using the MVC pattern. Here are some examples: Compo ...
by Paul Stovell via Paul Stovell on 11/9/2009 10:40:32 AM
Back to: Magellan Home Magellan was designed to work without an Inversion of Control or Dependency Injection container, to keep it simple and accessible. However, as applications become more complicated, modern WPF applications can benefit immensely from IOC containers. Magellan's extensibility points make using a container easy. Magellan resolves and instantiates two main types of objects - controllers and views. The out of the box implementation uses conventions, but they c ...
by Paul Stovell via Paul Stovell on 11/9/2009 3:07:35 AM
Back to: Magellan Home This guide will walk you through getting started with Magellan. You will need a copy of Visual Studio 2008 with Service Pack 1. Project Setup Download the Magellan library. Unzip it to a known location. Create a new WPF Application project using Visual Studio 2008. Add references to Magellan.dll and System.Windows.Interactivity.dll from the ZIP file that you downloaded. Create the following folder structure: Create a model In the Views/Home fol ...
by Paul Stovell via Paul Stovell on 11/8/2009 3:16:01 PM
Back to: Magellan Home Magellan is a lightweight framework that makes it easy to build WPF navigation applications. It is inspired by the ASP.NET MVC framework. The main features are: Model-View-Controller support Action filters for cross-cutting concerns such as authorization and redirection Blend behaviors to make navigation easy Transitions between pages Magellan was drawn from a number of samples I had put together early this year and some work done on a client project ...
by Paul Stovell via Paul Stovell on 11/8/2009 2:39:23 AM
Magellan is a lightweight framework that makes it easy to build WPF navigation applications. It is inspired by the ASP.NET MVC framework. The main features are: Model-View-Controller support Action filters for cross-cutting concerns such as authorization and redirection Blend behaviors to make navigation easy Transitions between pages Magellan was drawn from a number of samples I had put together early this year and some work done on a client project. Download the librar ...
by Paul Stovell via Paul Stovell on 10/25/2009 1:39:56 PM
by Paul Stovell via Paul Stovell on 10/9/2009 1:02:24 PM
Enterprise applications typically deal with many categories of strings. Human names, reference codes, SKU identifiers, email addresses - the list is huge. There are subtle rules that apply to many of them: Whitespace at the start and end of many strings should probably be ignored Human names probably shouldn't contain newlines, tab characters, the percentage symbol, or 27 dashes in a row For some strings, casing makes no difference when deciding equality, and sometimes it do ...
by Paul Stovell via Paul Stovell on 10/7/2009 12:16:53 PM
Sheldon is a WPF command line control, and code to integrate it with IronPython. It's designed as a sample that demonstrates how a WPF application might be made scriptable: This sample was created to pitch an idea to a client about enabling a macro system in their application. Users might be able to make use of functions like OpenAccount("ACME"), ExecuteJob("SalesForecast2009"), and so on. Using the Command Pattern, commands could be written to an Output window in the applic ...
by via Paul Stovell on 6/12/2008 9:21:15 AM
The ASP.NET MVC team developed a URL routing engine, similar to the engine in Rails, which has made it’s way into the rest of ASP.NET. ScottGu has covered it a few times in the past, and this post has some good examples of it. Here’s a quick example: routes.MapRoute("ShowProductByCategory", "Products/Show/{Category}/{id}", new { controller [...] ...
by Paul Stovell via Paul Stovell on 6/11/2008 2:47:20 AM
Snapshot enumerators are part of Bindable LINQ’s internal implementation which make editing collections while enumerating them possible. When you first started with .NET, you undoubtedly wrote code that looks like this: foreach (string item in strings) { if (item.StartsWith("H")) { strings.Remove(item); [...] ...
by Paul Stovell via Paul Stovell on 6/10/2008 2:19:56 AM
As with other LINQ operations, Bindable LINQ allows you to execute aggregates over values that can change over time. In the general sense, a Bindable LINQ aggregate is an operation that turns a series of values into a single value, and is not necessarily limited to numeric operations. Examples of such aggregates are classics such [...] ...
by Paul Stovell via Paul Stovell on 6/3/2008 8:53:36 AM
One of the upcoming additions in .NET 3.5 SP1 is a StringFormat parameter you can pass along with your bindings. Sacha Barber has an example of how to use it: <TextBlock Text="{Binding Path=AccountBalance, StringFormat='You have {0:c} in your bank account.'}" /> However, if you can’t install the service pack or you [...] ...
by Paul Stovell via Paul Stovell on 5/21/2008 8:31:30 AM
Last night at the QMSDNUG someone asked whether it was possible to implement INotifyPropertyChanged without hard-coding property names as strings inside code. For example, you would normally write: public string FirstName { get { return _firstName; } set { _firstName = [...] ...
by Paul Stovell via Paul Stovell on 2/28/2008 12:07:41 PM
Omar blogged a method to extract the selected values in an enumeration: http://blog.omarbesiso.net/index.php/2008/02/13/c-multi-valued-enumerators-flags/ Suppose you had an flags enumeration called Option. You could use his method to write the following code: Options options = Options.ReadOnly | Options.Archive; Console.WriteLine("You selected:"); foreach (Options option in EnumHelper.GetSelectedEnumValues<Options>(options)) { Console.WriteLine(option); } While a generic ...
by Paul Stovell via Paul Stovell on 2/21/2008 9:31:35 AM
Early this year Mitch suggested a string formatting syntax for C# vNext. His suggestion was that string.Format could be replaced with syntax like this: throw new Exception( @("{0} {1} {2}"|a|b|c) ); I think it’s a great suggestion and I too would like to see it. In the mean time, I’ve been making use of the following extension [...] ...
by Paul Stovell via Paul Stovell on 12/4/2007 3:06:18 AM
There’s a good thread on the ALT.NET mailing list about the use of extension methods over interface methods. Having used extension methods heavily in SyncLINQ, there’s something I wanted to highlight when it comes to choosing between regular methods and extension methods. Combining extension methods with interfaces can be very powerful. The IEnumerable interface is [...] ...
by Paul Stovell via Paul Stovell on 10/4/2007 12:31:30 PM
Often when creating classes, we add a number of constructors to the class that are usually just there for convenience’s sake; that is, to make life easier for the developers using the class. Take the following code: public class Contact { private string _firstName; private string _lastName; private [...] ...
by Paul Stovell via Paul Stovell on 7/25/2007 4:28:22 AM
One advantage functional programming has over imperative programming is that in most functional languages, many of the operations performed are stateless - you pass values in, you get values back, but they never rely on external resources (global variables, static variables, the file system, the registry, etc.). This allows the runtimes of these languages to [...] ...
by Paul Stovell via Paul Stovell on 7/6/2007 3:28:01 AM
Last night I gave my talk on Binding Oriented Programming at the Sydney .NET User Group. The agenda looked something like this: What is data binding? We looked at a number of important interfaces: INotifyPropertyChanged IDataErrorInfo IBindingList, BindingList<T>, INotifyCollectionChanged I also talked about a few advanced binding topics - check out my webcasts for more details: Binding to DataSets Binding to Objects [...] ...
by Paul Stovell via Paul Stovell on 7/3/2007 7:10:09 AM
An interesting bug that I stumbled across when building the Scenario Coverage Analyser for TFS is that when reflecting on a type, Type.GetCustomAttributes will often not return some of the attributes I expected. You can find more details on the bug here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1578987&SiteID=1 The basic issue seems to come down to loading from a server share or [...] ...
by Paul Stovell via Paul Stovell on 5/24/2007 3:02:12 AM
Yesterday I posted a short walkthrough that demonstrated how to make changes to the TFS cube. Today, I want to show how the same change could have been applied using SQL Server Analysis Management Objects. According to MSDN, when we want to deploy changes to an Analysis Services database, there are five ways in which [...] ...
by Paul Stovell via Paul Stovell on 5/23/2007 6:40:54 AM
In this post I’ll walk through opening the Team Foundation Server OLAP Cube in Visual Studio, and adding a custom field to a dimension. Recall from my previous post that there are three main types of things in a cube: MeasuresMeasures are the numbers. These will often appear as the values in the report, and are the quantitative [...] ...
by Paul Stovell via Paul Stovell on 5/23/2007 5:01:12 AM
Forget LINQ, .NET 3.0, WPF and Silverlight. Analysis Services is truly the most wondrous thing to have been released this decade. I’ve spent this morning getting intimate with the TFS Cube, as I have some custom data that I would like to inject into some reports, and since I’ve never used Analysis Services it’s been [...] ...
by Paul Stovell via Paul Stovell on 5/21/2007 2:41:36 PM
Seven seconds That’s how long it takes to split a piece of code into a base class. Five seconds That’s how long it takes to add an XML-doc comment to a method. Developers have a strange psychology when it comes to code quality. If you’re familiar with Maslow’s hierarchy of needs, the equivalent for most developers might be: [...] ...
by Paul Stovell via Paul Stovell on 5/21/2007 12:43:11 PM
Binding Oriented Programming (BOP) is something that I’ve been championing to a number of Readify colleagues. In my original post, I gave an example of how the BOP approach could be applied in a Windows Presentation Foundation application. Then in a post about the SecurityManager, I showed an example that used Windows Forms and followed [...] ...
The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.