Thank You Infragistics, Red Gate Software & CrystalTech Web Hosting

May 19, 2008

The May 17th 2008 Enterprise Develoepers Guild Code Camp was a super event.  We had the largest number of attendees ever this Code Camp.

But I don’t measure success by the number of developers willing to travel and give up a day off.  Rather I measure success by the countenance of the crowd at the end of the day.

Everyone is speaking with new found friends or business contacts; they are exchanging the highlights of their day; new ideas and possibilities are flowing; a developer received new insight or perspective that has them looking forward to Monday morning and sharing the solution their company has been looking for.  This Code Camp, like all the other Code Camp’s I’ve been to, was a huge success.

Requirements

In order for a Code Camp to execute smoothly and successfully the following four ingredents are necessary.  Maybe one day our Enterprise Developers Guild President Bill Jones will write a blog posting on exactly what it takes to organize a Code Camp.  Trust me the checkist is long.

From the above sponsors link you can see that we had many sponsors for this Code Camp.  I’m very greatful to each of the sponsors for their generous support of the Guild events.

We Thank You

I was directly involved in working with three of the sponsors and wanted to thank them personally.  What better way to thank someone, then by allowing them to share in the fruit of their giving.  Below are the winners of the software licenses donated by Infragistics and Red Gate Software.  In addition to the software licenses, both companies provided a box of accessories and t-shirts.

 Mark Bill
Bob Josh
 Adam

Infragistics also flew Josh Smith down to Charlotte to speak in the WPF Track of Code Camp.  Thank you Infragistics for blessing our Code Camp with Josh.

In addition to a very generous cash donation, CrystalTech Web Hosting also flew Chandi Johnson from Arizona to Charlotte to be on-site to assist developers with their hosting needs.  We have a good number of Guild members that have been using CrystalTech as their business’s web hosting solution provider for many years.  I myself have a personal web site with them and will be writing a Code Project article soon about two very cool ASP.NET solutions.

I met Chandi at MIX08 not long ago.  Within a few minutes I found that I was speaking with the “real deal.”  I must be a good judge of character and technical skills because 10 days ago CrystalTech agreed with my assessment and promoted Chandi to vice president.  Way to go Chandi!

Chandi

Close

On a personal note I’ve been using Red Gate’s SQL Compare product for 5 years.  Our company would not be successful without SQL Compare;  It allows us to very easily and quickly update our customers database schema over a VPN connection.  I’m also a very happy user of the Ant’s Profiler product.

I have also been using the Infragistics .NET Advantage for WPF since it came out.  Love this product and have learned so much from the example code provided in the product.

I case you are wondering, I personally paid for all the above products and web site hosting.  So you can see, I’m just another very happy user of Infragistics, Red Gate and CrystalTech.

Thank you again Infragistics, Red Gate and CrystalTech we Code Camper’s really appreciate you.

Have a great day!

Just a grain of sand on the worlds beaches.


WPF Multi-Tier Business Application Track Code Camp Source Code

May 16, 2008

This blog post contains the source code for three of the May 17th 2008, Charlotte Code Camp sessions.  I have also included a short video below that introduces this application.

In about a week, I’ll post links to videos of all six sessions from the WPF Multi-Tier Business Application Track.  Josh Smith and I each did three sessions at in this track.

Requirements

  • Visual Studio 2008
  • Infragistics xamDataGrid version 7.2. 
    • This is a free data grid for WPF that you can download Infragistics xamDataGrid here. 
    • If you have the Infragistics .NET Advantage for WPF Volume 7.2 you do not need to download the data grid.
    • Note:  you may need to reset the Infragistics references in this application if you have downloaded the free version of xamDataGrid.

The xamDataGrid is used in two of the application forms.

Application

The included application was used instead of PowerPoint slides during the Code Camp.  It also contains a demo sales application that uses each of the features of the provided library.  The application uses many of the WPF features I’ve been blogging and writing Code Project articles on over the last few months and consolidates them into an application.

I strongly recommend that you view the above Code Camp videos when I post them.  They will help you get started and fully understand this application and all the very powerful time/code saving features.

This application is written to show WinForms developers how to accomplish familiar programming tasks in WPF.  WPF is fully ready and provides a super platform for developing line of business applications.  In case you are wondering, I keyed in the XAML by hand.  I didn’t use Expression Blend or my code generator.  I’ve been spending so much time writing code that it was nice to get back into working with XAML.

The data for this application is stored in the \bin directory of the application in the DatabaseEngineData.xml file.  If you delete the file, the database will be recreated for you when the application starts.

CodeCamp2008OneCompressed

The above image shows the Sales Person Maintenance form using the xamDataGrid.  The data grid is fully editable and supports business object validation using the IDataErrorInfo interface.

CodeCamp2008TwoCompressed

The above image show a busy application with six open forms.  The Task Switcher allows the user to easily task switch between open forms in the application.

Video

Silverlight Icon

The video links require Microsoft Silverlight 1.0. If you do not have it, you will be prompted to install it when you click one of the links. After the short installation is completed, close the browser window that you did the install in and re-click the video you want to watch. You can also download it here. Windows XP or Vista required.

Application Overview and Introduction

Close

Source Code: After downloading the source code you MUST change the file extension from .zip.DOC to .zip. This is a requirement of WordPress.com.

Download Visual Studio 2008 Source 660KB

I hope that this demo application gives you a some more understanding of WPF and how WPF can be used to create line of business applications.

Have a great day!

Just a grain of sand on the worlds beaches.


Sample Series – IDataErrorInfo and the Infragistics xamDataGrid

May 15, 2008

This is the next sample in the Sample Applications Series. The purpose of the Sample Series is to provide concise code solutions for specific programming tasks. This sample provides a brief description of the problem, the solution and full source code.

I have been preparing for this weekends Code Camp in Charlotte, NC and wanted to use the Infragistics xamDataGrid in my example code.  That code will be posted here on 16 May 2008.

All of my business objects implement the System.ComponentModel.IDataErrorInfo interface.  This interface provides a simple UI agnostic method of validating business objects.

Currently the Infragistics xamDataGrid does not directly support the IDataErrorInfo interface.  (By the way, this awesome data grid is free.)

I did not want to imbed my business logic in my UI so I’ve come with a way to get the xamDataGrid to cleanly support the IDataErrorInfo interface.

If you are not familiar with the IDataErrorInfo interface, please read up on this very cool interface before proceeding.

System Requirements

You MUST have the Infragistics free xamDataGrid or .NET Advantage for WPF Volume 2 installed on your system to compile and run this application.

If you are using the free xamDataGrid you may need to change the references to the Infragistics libraries.  I’m not sure if the names match or not.

Sample Application

xamDataGridOne

The above image shows a xamDataGrid with several rows.  Each row’s DataItem is an instance of the SalesPerformance class.

xamDataGridDataClassesJPG

This simple class has two data properties ProductLineId and SalesAmount along with the IDataErrorInfo.Item and IDataErrorInfo.Error property.

The ProductLineId property is the foreign key to the ProductLine.ProductLineIdent field.  This value is used by the Product Line ComboBox to display the ProductLine.Name.

This is a very typical scenario found in business applications that uses a normalize database.

Row Editing

xamDataGridTwo

In the above image, the user has selected a value in the Product Line ComboBox that does not meet the validation rules for the SalePerformance.ProductLineId property.

The ComboBox now has a red border.  In addition, the user can’t edit any other row until this row is valid.

The Sales Amount field also has a validation rule that requires the value to be greater than or equal to zero.

xamDataGrid Timing Cycle

When you perform an edit on a cell the following events are raised in this order.

  • xamDataGrid:  RecordUpdating
  • xamDataGrid:  EditModeEnded

So our code must be able to manage the process using the above events in the order that the xamDataGrid raises them.  For those who are wondering, I don’t use the EditModeEnding event because the value in the bound DataItem has not yet been changed.  Since the property value is not reflected in EditModeEnding, validating the object in that event handler will do us no good.

RecordUpdating Event Handler

    Private Sub xdgSalesPerformance_RecordUpdating(ByVal sender As System.Object, _
                   ByVal e As Infragistics.Windows.DataPresenter.Events.RecordUpdatingEventArgs)

#If DEBUG Then
        Debug.WriteLine("xamDataGrid:  RecordUpdating")
#End If

        'if there are errors on the object, cancel the update.
        'this keeps the user from editing other records until this record is corrected
        If DirectCast(DirectCast(DirectCast(e.Record,  _
            Infragistics.Windows.DataPresenter.DataRecord).DataItem, System.Object),  _
            IDataErrorInfo).Error.Length > 0 Then
            e.Action = _
                Infragistics.Windows.DataPresenter.RecordUpdatingAction.CancelUpdateRetainChanges
        End If

    End Sub

The above event handler is very simple.  It gets a reference to the DataItem and casts it as an IDataErrorInfo.

The RecordUpdating method is the icing on the cake.  If the e.Action is canceled, the xamDataGrid will not allow the user to edit another row in the xamDataGrid until the current row is corrected.

EditModeEnded Event Handler

    Private Sub xdgSalesPerformance_EditModeEnded(ByVal sender As System.Object, _
                  ByVal e As Infragistics.Windows.DataPresenter.Events.EditModeEndedEventArgs)

#If DEBUG Then
        Debug.WriteLine("xamDataGrid:  EditModeEnded")
#End If

        'get the data object
        Dim obj As IDataErrorInfo = DirectCast(DirectCast(DirectCast( _
            DirectCast(e.Cell, Infragistics.Windows.DataPresenter.Cell).Record,  _
            Infragistics.Windows.DataPresenter.DataRecord).DataItem, System.Object),  _
            IDataErrorInfo)

        'query the objects IDataErrorInfo.Item property for any errors on this column's data
        Dim strErrorMessage As String = obj.Item(DirectCast(DirectCast( _
            e.Cell, Infragistics.Windows.DataPresenter.Cell).Field,  _
            Infragistics.Windows.DataPresenter.Field).Name)

        If strErrorMessage.Length > 0 Then
            'indicate a data entry problem
            e.Editor.BorderBrush = Brushes.Red

            'save the current tooltip
            If e.Editor.ToolTip IsNot Nothing Then
                e.Editor.Tag = e.Editor.ToolTip
            End If

            e.Editor.ToolTip = strErrorMessage

        Else

            If e.Editor.Tag IsNot Nothing Then
                e.Editor.ToolTip = e.Editor.Tag
                e.Editor.Tag = Nothing

            Else
                e.Editor.ToolTip = Nothing
            End If

            'clear the data entry problem indicator
            e.Editor.BorderBrush = Nothing
        End If

    End Sub

This is another super simple event handler.

This code gets a reference to the DataItem, validates the value using the IDataErrorInfo.Item property and then sets or removes the error visual clue in the UI.

Close

Source Code: After downloading the source code you MUST change the file extension from .zip.DOC to .zip. This is a requirement of WordPress.com.

Download Visual Studio 2008 Source 23KB

You can see how very simple it was to get the xamDataGrid to work with your business objects that support IDataErrorInfo interface.  After looking at what I’ve done, you can see that extending the xamDataGrid to encapsulate this behavior wouldn’t take but a few minutes.

Maybe in the future Infragistics can provide support for the IDataErrorInfo interface.  Possibly a property on a column that indicates that this column should be validated using IDataErrorInfo interface.  A nice ValidationErrorTemplate like the WPF controls have might also be possible instead of hard coding the border color to red.

We front line developers need to let our software tools vendors like Infragistics and Microsoft know that built in support for IDataErrorInfo is required and greatly simplifies business application development.

Hope you can learn just a little bit more about .NET from this article and the Sample Series.

Just a grain of sand on the worlds beaches.


Metadata – a Voice Crying in the Wilderness, Hey! I’m Over Here

May 8, 2008

Welcome to Metadata Island.  It’s a beautiful place.  Rich in resources that represent the hard work of application designers, business analysts and their customers.  Those very long specification meetings.  Countless missed meals typing up specifications.  Yes we have all contributed to the paradise repository called, Metadata Island.  Not to mention this vast metadata resource that sits dormant which companies paid tens of thousands of dollars to create.  If you were to get in your boat, the lone guy managing the metadata can be heard on the beaches waving his arms and crying out, “Hey!! I’m over here!”

104004A.TIF

The Problem

Bottom line; the once thought out and complete metadata never gets off the island after it arrives.  Current development tools are not set up to take advantage of developer metadata during the form or code generation processes.  Anyone ever used Microsoft Access?  Since Access 1.0, the program utilizes the developers metadata stored in the table object.  The form and report designers expose this metadata in a ComboBox allow the developer to drag a field to the design surface and Access will create the control and corresponding label.  It also has Mr. Wizard that creates forms and reports for you.

Why should our developers have to retype ToolTip text into form property grids?  Why should developers spend time entering data into property grids at all, especially the same data that is sitting on Metadata Island?  Beside being error prone, software companies are having to pay another person to enter this same data into yet another interface.

Why Did I Write This?

Before I get much further I must explain the context of this blog post.  First and foremost, I’m not a Microsoft finger pointer, not by a long shot.  We have fantastic tools and outstanding developers that I have deep respect for standing behind them.

I have been to two recent Microsoft events, MIX08 and the 2008 Microsoft MVP Summit.  I didn’t hear anything in any keynote, presentation or off-line conversation about any plans for Visual Studio or Visual Studio related tools to consume developer metadata.  I feel so strongly about this, so I wrote this blog post to raise the awareness of this need and to demonstrate how simple this is to accomplish.

I like Visual Studio 2008 and Expression Blend 2 and 2.5.  I like that I can open a designer and the tool creates classes for me.  Someone worked real hard to deliver that tool.  Where I get disappointed is when I have a great tool that I can’t use because it can’t consume my metadata.

For example the LINQ to SQL and SQLMetal tools don’t currently add XML comments to my classes or add my attributes to my properties.  But this would be easy to accomplish.

Currently there is no way to use the tools and have them populate a control’s properties based on my metadata as the control is being dragged to the design surface.  But this would be easy to accomplish.

Video Demonstrations

Please watch the two below videos.  The first one demonstrates a program I wrote that uses metadata to generate WPF forms in milliseconds.  It can also generate individual controls  The second is a short video on the program and how simple it was to write.

When I made the videos, this was using the Alpha One version.  Since then I have updated it after getting suggestions.  The version in the video works great but has been updated and now looks like the version at the bottom of this post.

Silverlight Icon

The video links require Microsoft Silverlight 1.0. If you do not have it, you will be prompted to install it when you click one of the links. After the short installation is completed, close the browser window that you did the install in and re-click the video you want to watch. You can also download it here. Windows XP or Vista required.

Metadata Form Generation Video

Metadata Form Generation How I Did It Video

The Solution

We need bridges from our tools to Metadata Island.  Bridges is such a friendly and happy word.  The phrase, “bridge building or building bridges” is normally used in the context of good, of creating relationships or joining separate objects.

After watching the first video, no one can now say, WPF is not RAD capable.  In fact this simple tool is way faster than the great Winforms designer.  I spent a days time thinking the tool out, writing and testing it.

metadataislandbridges

I have been thinking about metadata and code generation since I wrote the Visual Studio 2008 Designers and Code Generators; You Have Overlooked (…) blog entry.

I have come up with two bridge building methods I think would work.  Of course there are much smarter architects and developers working on tools than me, so maybe they would have a better solution that what I’m proposing here.  I’m just praying the ball gets rolling in time for the next release of Visual Studio or possibly a service pack to Visual Studio 2008.

Solution A:  Bridge Provider Model

This would be the simplest solution to implement and one that completely decouples the tools from the developers.

In each Visual Studio Solution the developer would place a .dll in the MetadataProvider directory of the solution that was decorated with the required attributes.

When Visual Studio opens the solution, it looks for it, similar to the way it currently does for Visualizer .dlls.

Here is the workflow.  When LINQ to SQL or SQLMetal needs to write a class or property object they pass the class name and property name and the MetadataProvider either returns a string or nothing.  If nothing, then the tool simply uses its default implementation like it does today.  If a string is returned, then that string is used for that object.  This would allow developers to create the property with XML comments, attributes and property getter and setter code that they want to use.  This way the code the the LINQ to SQL designer generates now looks exactly like code I would have hand coded.  Now everyone is happy, very happy.  How easy would this be to code into the current tools?

If the developer wanted to generate a form, they would select a business object class that would be used to populate a Data Grid like my program and then generate the code.  So in this case, Visual Studio would be interacting with the .dll in the MetadataProvider directory twice.  Once to fill up the grid and once when each object is created.  Again, very simple workflow and almost zero impact on the current tools.

Advantages

The major advantage to this solution is that it completely decouples the tools from the solution.  The tools do not have to be concerned about metadata management.  Just call the provider and use what it returns.

Solution B:  Metadata Model

This solution would require that a metadata model be established and then developers could populate.  This model would be consumed by the tools during object construction.

This model would require that the solution expose templates that could be modified so that the constructed classes, properties and controls be generated exactly if a developer had hand coded them.

Program

I have receieved a few emails about the program so I’ll give the overview.

metadataislandnewcompressed

I used the Infragistics xamDataGrid in the above application for very easy editing of the individual metadata objects. 

Most of the columns are editable.  The control type column is a ComboBox and the two button columns allow the creation of the control by clicking the button to copy the control to the clipboard as in the demo video or allow the control to be created by dragging the button to a Visual Studio or Blend XAML editor and the control is created there.

You can see I’ve also have put my Code Generator here also.  I’ll post some more videos soon on this entire application and demonstrate how RAD WPF development can be.

Close

My program is not a templated solution.  It’s coded to generate code they way I would write it.  This makes my program very useful to me and anyone that subscribes to my methods and Core library that I have written.  We also have a super clean metadata store for our applicaiton generation.

Until the tools catch up, I hope this encourages you to start mining your own rich metadata stores and bringing that well thought out data into your development cycles.

Have a great day and thank you!

Just a grain of sand on the worlds beaches.


Needed Features In Visual Studio 2008 Server Explorer

May 2, 2008

I’ve been trying to utilize the Server Explorer in Visual Studio 2008 for my SQL Server programming tasks like table maintenance and stored procedure authoring.  However this new workflow is not as productive as using SQL Server Management Studio.

Viewing Columns

A quick glance at the below images shows that Visual Studio 2008 does not display the same MUCH needed column information.  Yes, when you click on a column, the Visual Studio 2008 Properties Window displays this and more data.  However, when you click back to the code window or anywhere else, the Properties Window data changes.  Also, having to click on a column to see its information slows the developers workflow down.  Please display at least the same information that SSMS does for a column.

SQL Server Management Studio Visual Studio 2008
visualstudioone visualstudiothree

Copying Column Name(s)

Another very missed piece of functionality is the ability to copy one or more column names from the above displayed list into either a stored procedure or code window.

In SSMS the developer can drag the Columns folder into a code window and all column names are copied into the code window separated by commas.  Visual Studio 2008 does not have this.

In SSMS the developer can drag the column name into a code window and the column name is copied into the code window.  Visual Studio 2008 does not have this.

This is an invaluable time saver and ensures accurate copying of column names into code or stored procedures.

Viewing Stored Procedure Declarations

A look at the two below images shows that Visual Studio 2008 does not display the same MUCH needed parameter information.  This functions that same way and has the same limitations at the above table columns.

SQL Server Management Studio Visual Studio 2008
visualstudiotwo visualstudiofour

Help Get This Fixed

I have posted this problem on Microsoft Connect here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=341791

Please rate this issue on Microsoft Connect so that it will get corrected. 

VS2005 had the same issue and I wish I would have known how to report problems like this long ago.

Close

I was going to write this up on the Visual Studio 2008 forums, but you can’t post images (which is a very good feature) so I wrote it up here where I could post the images and wrote a text only version that you can read here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3281961&SiteID=1.

I do like the fact that many features have been moved into Visual Studio (STRONGLY wish SSMS could debug stored procedures) but if I’m being asked to alter my workflow, then I should at least have the same features that the other tool does.

Microsoft, please update Visual Studio 2008 with these features.

Have a great day and thank you!

Just a grain of sand on the worlds beaches.


Registration Now Open for Enterprise Developers Guild Code Camp on 17 May 2008

May 1, 2008

On Saturday 17 May 2008, the Enterprise Developers Guild will have their spring Code Camp at the CPCC Central Campus located in Charlotte, NC.

Directions and registration is posted here: http://www.developersguild.org/Default.aspx?alias=www.developersguild.org/codecamp/2008/spring

Code Camps are very informative, free and fun.

Code Camp Tracks

  • WPF Multi-Tier Business Application Track
  • VS 2008 / SQL 2008 Labs Track
  • Agile Track
  • Presentation Track

I have updated the information on the WPF Multi-Tier Business Application Track that you can read here: http://karlshifflett.wordpress.com/2008/04/06/may2008codecamp/

See You At Code Camp!

Have a great day!

Just a grain of sand on the worlds beaches.