[WPF] An addin to quickly generate your business objects compatible with WPF !

When I work on projects, I often need to create business objects (Customer, Country, etc.) and I would like to be able to done this step very quickly.

So I’ve created a little addin to Visual Studio 2008 that allow me to easily create my business objects/entities. This a an old project that I’ve decided to release even if I plan to re-write it because I think it could be an useful in addition to the XAML PowerToys developed by Karl Shifflett. To use it, just right click on a project and select “Add Business Object” under “VS PowerTools”:

image

Once this is done, a little window is displayed and you can specify the name of your entities, if you want to mark it as serializable (using the DataContract/DataMember attributes) and the number of properties:

image

 

Once you have entered the number of properties you want on your entities, just press the TAB key to see an interface that allow you to write the name and the type of the properties:

image

When you’re done, simply click the “OK” button to launch the create of the entity. Using CodeDOM, the addin performs the following tasks:

  • Add the references and “using” necessary
  • Create a partial class corresponding to the entity you have entered the name. This class implements INotifyPropertyChanged and INotifyPropertyChanging
  • Create the partial methods corresponding to the properties defined in your class
  • Define a collection for your class. The collection is simply a ObservableCollection of the type you’ve just created
  • Etc..

image

To install the addin, simply copy the file VSPowerTools.dll and VSPowerTools.AddIn to the Addins directory of Visual Studio 2008 (by default, it’s C:\Users\Username\Documents\Visual Studio 2008\Addins)

Here is a list of the thing that I’m planned to do for this addin:

  • Use M-V-VM pattern for the WPF part
  • Allow user to select if he want C# or VB.NET generated code
  • Manage the “Add Reference” part to support Silverlight (currently, the addin adds, as reference, the assemblies for the .NET Framework only, not Silverlight)
  • Maybe use a package instead of a simple addin

Here is the link to download the addin: http://morpheus.developpez.com/wpf/tools/addins/VSPowerTools1.0.zip

If you have any ideas or comments about this addin, feel free to contact me or to post a comment !

Happy coding !

8 Comments

Comments have been disabled for this content.