WPF

There are 14 entries for the tag WPF

Build enterprise applications with WPF, WCF, EF and Prism. Tutorial 09.

13 February 2010 |

Today we will see the modularity concept of Prism. Probably the best part of it, as it will allow us to build a real plug-and-play application where the main Shell won’t know anything about the modules. Discover and load the module. What does it mean? As we saw in the previous article, we have declared a reference in our Shell for the hello world module. In this way we force the Shell to be compiled including in the shell project a reference to the Hello World module. Fine, but what happen if we want to replace this module...

Build enterprise application with WPF, WCF, Entity Framework and Prism. Tutorial 06.

08 November 2009 |

Configure your Customer lookup and run it on IIS 7.0 In the previous article we saw how to use WCF (a basic approach) and what we should keep in consideration if we want to use SOA as our repository. Now we need to: Change the WCF service to point to a real database Test the service Build a web site to host our service Host the web site on IIS 7.0 The the final result ...

Build enterprise application with WPF, WCF, Entity Framework and Prism. Tutorial 05.

08 November 2009 |

Update: source code and documentation are now available on CodePlex at this address: http://prismtutorial.codeplex.com/ Starting with WCF. Today we will see how WCF works and what are the best practices we should use in order to keep our application safe and maintainable. WCF startup. I assume that you know already what is WCF and what’s the difference between WCF and the old Web Service technology. If you don’t, this is a nice overview of WCF, and this is a nice overview of the differences from these 2 technologies. The big difference...

Build enterprise application with WPF, WCF, Entity Framework and Prism. Tutorial 04.

01 November 2009 |

Service Oriented Application. Introduction. The first problems I always encounter when I design a scalable, multi-tier application are: Work on a disconnected environment but be able to work with the data previously downloaded. Keep always the data up to date, notify the users when the data changes. Threading and UI performances, do not provide frozen screen when the user requests the data. Synchronization from the database and the disconnected environment. Those are common problems of a complex software and can be solved using...

Build enterprise application with WPF, WCF, Entity Framework and Prism. Tutorial 03.

01 November 2009 |

Update: source code and documentation are now available on CodePlex at this address: http://prismtutorial.codeplex.com/ Value and business validation with Enterprise Library 4.1 and Entity Framework. In this article I will show you how to validate a domain using the enterprise library 4.1 over the Entity Framework. First of all I want to talk about the validation and the thousands of implementations you can find over the web. In my opinion there are 2 different types of validation. The value validation and the business validation. What’s the difference? The first, the value validation...

Build enterprise application with WPF, WCF, Entity Framework and Prism. Tutorial 02.

25 October 2009 |

Update: source code and documentation are now available on CodePlex at this address: http://prismtutorial.codeplex.com/ Build a generic repository with the Entity Framework. In the previous series of articles about M-V-VM we used the AdventureWorks database, available on CodePlex. After this article (configure a data layer with LinQ-to-SQL) I have got some reader’s emails asking me this and that. So, I am going to give you all those answers right now. Download and configure the Adventure Works database. On my dev PC I have SQL Server 2008 Standard version, but...

WPF and MVVM tutorial 08, messaging.

13 August 2009 |

Before continue our tutorial I want to take a break and talk about the messaging options. Also because the MVVM is a new interpretation of an old pattern, some of my friends are using the Mediator Pattern and today we must talk about that before building the Details view. As it was requested by many people, here is the location of the source code on CodePlex: www.codeplex.com/MVVM. Please refer there to any issue. Communication through the views. Before starting we need to spend 5 minutes over the communication. The first solution we used...

WPF and MVVM tutorial 07, the List search.

03 July 2009 |

Ok, starting from this post we are going to do something really interesting. In this episode we need to create a simple List windows, but as you will see the logic will not be so different then a one-to-many form. This will be the final result: The ViewModel for the List Window. First of all we need to create the view model. The view model should have the following commands: New – Add a new Customer Save – Save all the changes we did … ...

WPF and MVVM tutorial 06, start up form.

17 June 2009 |

Today we are going to create the start-up form of our project and use the first ViewModel to run the application logic. The result we want to obtain will be: The View Model for the Startup form. In our project, let’s go to the ViewModel section and create a new class. This class will inherit from the basic View Model class like the code below: 1: public class StartViewModel : ViewModel { 2: 3: public StartViewModel() { 4: 5: ...

WPF and MVVM tutorial 05, The basic ViewModel.

16 June 2009 |

As we saw in the previous posts, a view model should be an abstract implementation of what the view needs to show about the model. We should implement an observable collection of something, we should implement an INotifyPropertyChanged interface and we should have a collection of RelayCommands. For these reasons, it simply to understand that we need a basic abstract ViewModel class, just to recycle some code. The Basic View Model. 1: namespace MVVM.ViewModel { 2: public abstract class ViewModel:INotifyPropertyChanged,IDisposable { 3: 4: ...

WPF and MVVM tutorial 04, The Commands.

15 June 2009 |

In the previous posts we saw the basic of our project, the model (domain entities) and a simple repository. Note: please note that the sample I wrote about an agnostic UnitOfWork is just to show you a simple pattern to handle L2S but it can be done better. The ViewModel. What is the view model? Well the simplest explanation is enclosed in this definition: the view model should be the datacontext of our view. It should provide the commands, the observable collections used in the view and the error logic. Before starting to view how to...

WPF and MVVM tutorial 03, The user repository.

05 June 2009 |

Before starting to view in depth our model, or to design the views, I want to complete the DAL layer. Now that we have our unit of work implementation and our data context we need to implement a couple of repositories. If you want to view how it should work a repository, I suggest this interesting article from Martin Fowler. The presenter should be: A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection. The Flow of our application. During the time I saw different...

WPF and MVVM tutorial 02, The model.

05 June 2009 |

In the first part of this tutorial we saw the MVVM model and how it works. In this part of our tutorial we will work directly with the Entity Model and LinqToSQL. I am using a database-first approach so in my opinion using LinqToSQL will be better then Entitiy Framework. I am going also to show you an easy way to build a custom Unit Of Work to manage the context status with Linq 2 SQL. The Visual Studio Project. First of all open a blank Visual Studio solution, I called it WPF.Tutorial.VMMV. Add two projects on...

WPF and MVVM tutorial 01, Introduction.

03 June 2009 |

With Microsoft WPF technology, a new pattern is born and is going to be called MVVM (Model View ViewModel). This pattern is an hybrid from the old MVC and the old MVP patterns. Why a new pattern for the presentation? First of all WPF technology is giving us a kind of technology that can completely change the approach to design and code the UI. With the VMMV we can completely design an agnostic UI that doesn’t know the Model we are going to pass to it. Recycle, I will show you in...