Rockford Lhotka's Blog

Home | | CSLA .NET

 Tuesday, 29 May 2007

I post this in the hopes that it will help prevent someone else’s pain. And because the search engines (live and google) never did give me any of these answers – they are totally clogged up with content from pre-release versions of Vista and with sites trying to sell or review mobile devices…

My wife has an HP 4150 – a wonderful little PDA. And a while back I put Vista on her laptop. Yesterday she tried to get it to sync, but Vista wouldn’t recognize the device. So she asked me for help, and there begins my tale of woe.

She was right, Vista would see the device through Explorer, so you could copy files back and forth, but the Windows Mobile Device Center (WMDC) wouldn’t see it at all.

After much time googling (see above) I gave up and went directly to the WMDC site – their home page never did show up in google (or… They say clearly that Windows Mobile 2003 is supported, and the HP 4150 clearly runs WM2003.

So now I’m perplexed. What could be wrong? Ahh! Perhaps there’s an update to the device from HP.

Go to and sure enough, there’s a ROM upgrade, which I downloaded.

By this point it was a little late, and I was a little frustrated that something so simple and obvious could be so hard. And the Microsoft page made no mention of any difficulties or challenges. No help with troubleshooting – or even any indication that troubleshooting would be required.

So I ran the ROM upgrade utility. On the Vista box. Stupid me. It started, and then failed. Leaving the IPAQ in a totally locked state. As long as the battery was in the device (I took the batter out a few times trying to reset things), the device was on a white logo screen showing a couple numbers (which I assume are hardware revision numbers or something).

At this point I appear to have a battery-powered paperweight, where once I had a PDA. Damn!

That was last night. Fortunately I have some awesome colleagues, and a couple of them replied to my email rant (I wasn’t happy).

Overnight I had left the battery out of the device. It apparently takes a few hours for some capacitors to discharge, and so at a colleague’s suggestion I put the battery back in this morning. Much to my relief the device rebooted with factory settings. Whew!

Then, following the suggestion from a Microsoft colleague, I ran the ROM upgrade from an XP machine. While the ROM upgrade utility will try to run on Vista, it won’t succeed – bad HP for not including an OS version check in such a critical utility!! One simple check like that would have saved me substantial trouble!

The upgrade works great from XP. Which is a lesson: if you decide to upgrade to Vista, make sure to keep at least one XP machine around for the next year or so, until these issues get ironed out. (A corollary to this is that if you only have one machine, you probably won’t want to go to Vista…)

It turns out however, that the ROM upgrade didn’t fix the sync issue. This is because Vista didn’t ship with the release version of WMDC. To get the release version of WMDC 6, you need to go to  and download the current version.

In theory I guess Windows Update is supposed to update WMDC for you, but in my experience that’s not true. I had to do force the upgrade manually.

Also, I still don’t know how to find out the version of WMDC you have installed on a machine. So I guess you could argue that everyone should go run that update just in case.

So let me recap. I did the following:

·         Tried to sync a WM2003 device with Vista (a supported activity, with no indication that there are issues from Microsoft’s web site) – this failed

·         Tried to do a ROM upgrade of the HP 4150 from Vista – this failed horribly

·         Found out that the device would reboot after a few hours without power (thankfully!)

·         Did the ROM upgrade from XP – successfully

·         Manually upgraded WMDC on Vista

·         Got the device to sync with Vista

Now my wife has a PDA again, which makes her happy. And that, of course, makes me happy.

And with any luck, this post will appear within the first few pages of a search about how to sync an HP IPAQ 4100 series (HP 4150) with Windows Vista through the Windows Mobile Device Center, and so can save someone else all the time and effort this process cost me…

Tuesday, 29 May 2007 08:46:32 (Central Standard Time, UTC-06:00)  #    Disclaimer
 Monday, 21 May 2007

I have made CSLA .NET 3.0 Beta 1 available for download from the CSLA download page.

The changes in CSLA .NET version 3.0 are primarily focused on adding support for .NET 3.0 features: specifically WCF and WPF. No extra work was required to allow business objects to invoke WF workflows or to be used from activities in a WF workflow. There are also some very important bug fixes and feature enhancements that most people will want even when not using .NET 3.0.

There are no major or intentional breaking changes from version 2.1.4 to version 3.0.

CSLA 3.0 will work on .NET 2.0. You do not need .NET 3.0 to use this version. Obviously the WCF/WPF/WF features are only available to you if you have .NET 3.0.

The WCF support comes in two forms: a data portal channel, and comprehensive support for the DataContract/DataMember attributes. The data portal support comes in the form of a new data portal proxy, which is functionally equivalent to the CSLA 2.0 channels. In other words, upgrading to WCF is entirely transparent. The DataContract support is an optional configuration switch you can set in app.config/web.config to tell CSLA to use the WCF serializer rather than the BinaryFormatter. This affects n-level undo and cloning. If you want to use DataContract instead of Serializable on your business classes you must use this config switch.

The WPF support comes as a set of controls. These controls provide support for validation (like the Windows Forms ErrorProvider), authorization and a couple other key features. There is also a CSLA data provider control, allowing the creation of codeless XAML forms in some cases (for read-only data).

In addition to the .NET 3.0 support, there are some other functional enhancements to various areas. Here are some highlights:

  1. Validation RuleArgs are now more sophisticated, allowing for more expressive human-readable rule descriptions, and providing a better model for code generators when specifying arguments to be passed into a rule method.
  2. A number of bugs in BusinessListBase related to data binding scenarios have been fixed. Event handling for other list classes has been standardized as well. You will likely find that data binding to grids is much more reliable in 3.0 than in 2.1.4.
  3. SmartDate has some minor enhancements and bug fixes.
  4. N-level undo now detects when edit levels are out of sync and throws an exception. This helps locate and debug problems where nested begin/cancel/apply calls are out of order. While this feature will most likely cause some short-term pain as you find these issues, the result is that your code will behave properly.

For the complete list of changes, see the change log.

My plan is to leave this beta online for 2-3 weeks, followed by a second beta in mid-June and a release at the end of June. If you plan to move to CSLA .NET 3.0 within the next few months, please consider downloading and testing this beta. Let me know about any issues you find so I can resolve them for Beta 2.

Thank you!

Monday, 21 May 2007 19:00:02 (Central Standard Time, UTC-06:00)  #    Disclaimer
 Friday, 11 May 2007

Earlier I blogged about the fact that the Orcas Beta 1 VPC image doesn't have ASP.NET set up with IIS, so you have to do that. Unfortunately there are a couple other issues I've discovered. Here's the full list:

  1. IIS isn't configured for ASP.NET
  2. Windows authentication isn't enabled for the default web site in IIS - blocking the use of VS debugging until you enable it
  3. The default for a VS Orcas web site is to build for .NET 3.5. If you attempt to debug such a project (when it is set to run in IIS) you'll get an error dialog with a vague message about an authentication error. The reason for this is that ASP.NET only supports .NET 2.0. To resolve this, you must go into the web site's properties dialog and set its target .NET version to 2.0. You can still reference the 3.0 and 3.5 assemblies and use the new features, but VS must build to .NET 2.0 or you can't debug in IIS.

    But it isn't just the debugger - other features may not work properly either, possibly resulting in a "hang" when you try to access a page.

For those of you at my workshop at VS Live this past Sunday, this was why my web site wouldn't run properly in the VPC. Fortunately there is this workaround, but I hope Microsoft provides a more comprehensive solution in the release version, because it is quite confusing to have to set your build version back to 2.0 even though you are really building against 3.5...

Friday, 11 May 2007 09:01:33 (Central Standard Time, UTC-06:00)  #    Disclaimer
 Friday, 04 May 2007

I have put a test version of CSLA .NET version 3.0 up for download from the download page.

This release includes both VB and C# versions of CSLA .NET 3.0, though the WPF support in the VB version has undergone relatively little testing.

The C# ProjectTracker sample is relatively complete, though I'm still chasing down some WPF navigation issues, and may change it over to a Windows-based approach.

The VB ProjectTracker sample isn't as complete, but I've included it in the download nonetheless.

I expect that this is the last pre-release of the CSLA .NET 3.0 framework itself - the next release will be a beta release, and it is my hope to be done with 3.0 by the end of June. If you have the time and inclination, please download the framework and give it a try.

You should be aware that CSLA .NET 3.0 should work just fine on machines with only .NET 2.0, or with .NET 2.0 and 3.0 installed. It also works fine on Orcas Beta 1 (with .NET 2.0, 3.0 and 3.5 installed), though you'll have to upgrade the solution if you try to open it in VS Orcas.

Obviously if you only have .NET 2.0 installed, you can't use WCF or WPF. Attempting to use those features in CSLA .NET will result in compile or runtime errors. However, there are numerous bug fixes and enhancements to other areas of CSLA .NET that may benefit .NET 2.0 users. If you find that CSLA .NET 3.0 doesn't work for you under .NET 2.0 (without .NET 3.0 installed) please let me know so I can address any issues.

I am not aware of any breaking changes from CSLA .NET 2.1, so switching an existing project to use CSLA .NET 3.0 should be straightforward. If it is not, please let me know so I can either address or document any issues.

Friday, 04 May 2007 22:14:37 (Central Standard Time, UTC-06:00)  #    Disclaimer
 Tuesday, 01 May 2007

This week Microsoft fully disclosed their plans for Silverlight. It is not only a way to build rich internet applications (RIAs), but it is a way to build them with .NET! This is very exciting news, and I hope that Microsoft follows through on their vision for Silverlight!!

With the support of Magenic, I've been researching the possibility of creating a CSLA Light which would run in an Internet zone sandbox, and in the even more restrictive Silverlight environment. The Silverlight 1.1 alpha available today doesn't have enough functionality to even come close to hosting something like CSLA, but Microsoft's plan for Silverlight should provide enough functionality to create a stripped down, client only version of CSLA.

That means no data portal, no Clone() method, and the requirement to implement GetState() and SetState() methods to support n-level undo (thanks to no private reflection). But it does mean that I should be able to provide the full validation, authorization, data binding and n-level undo capabilities of CSLA .NET in the CSLA Light version.

I also plan to provide the data portal interface so factory methods can remain consistent, but the back-end implementation will be quite different. (I can't do mobile objects due to no serialization, and I can't do the strongly-typed DP_XYZ calls due to no private reflection). The lack of a real data portal is pretty hard to take, but I haven't figured out a way to do it, so it is probably unavoidable...

I anticipate that around 80% of the code you'd write in a business object today will be the same in CSLA Light, perhaps even more.

Thanks to the compatibility between Silverlight and WPF/.NET itself, there are some other interesting possiblities for CSLA Light. Code written for Silverlight should always run in a less restrictive environment like WPF on Windows, or even XBAP/WPF in a browser. Due to this, CSLA Light will almost certainly work in those settings as well.

In any case, this will be a somewhat slow moving initiative, because I have to wait until Microsoft comes out with a release of Silverlight that supports key WPF features like data binding before I can get too far with the project...

Tuesday, 01 May 2007 16:25:03 (Central Standard Time, UTC-06:00)  #    Disclaimer
 Friday, 27 April 2007

The third pre-beta test release of CSLA .NET 3.0 is now available for download.

This release doesn't include any major changes from the previous release, but does include a set of bug fixes and stabilization.

This release does include an updated ProjectTracker application, which now includes:

  • PTWpf - the almost completed WPF UI for ProjectTracker
  • PTWorkflow - a simple workflow that makes use of CSLA-style objects in the activities
  • WcfPortal - a data portal host for the WCF data portal channel
  • PTWcfService - a WCF service interface, much like the older web service interface
  • PTWcfServiceClient - a Windows Forms client app for PTWcfService

Plus, of course, all the pre-existing Windows, ASP.NET and web service interfaces and data portal hosts.

This release is only available in C# at the moment. The WCF data portal channel for VB is complete, and is available directly from the svn repository. I'll port the remainder of the changes to VB once I'm more confident that they are stable (which should be in the relatively near future).

Friday, 27 April 2007 20:48:44 (Central Standard Time, UTC-06:00)  #    Disclaimer
 Thursday, 26 April 2007

I'm confused...

Reading through the WPF docs it is pretty clear that, when building a page-based WPF app, the WPF container (which looks kind of like a stripped down IE) doesn't keep old page instances in memory. So when you click the back button, previous pages are reloaded.

I found this to be the case with one of my pages, where not only did the page reload, but all the data binding was broken when that occurred. So I had to set KeepAlive to true for that page to make it work. That made some sense to me (though I still don't understand why the data binding within the page was all messed up...)

But now I'm finding that other pages are not reloaded. In fact, they are cached in memory, so when I use the Back button to get to them they are showing outdated data.

What a serious pain. I'm sure there are some rules at work behind the scenes here - but I wish the WPF docs were more clear as to what those rules actually were... It appears that the rules are designed to frustrate me: when I want a page to stay in memory it gets reloaded, but when I want a page to reload it stays in memory. Perhaps that's the rule? :)


So the problem I'm trying to resolve right now is this:

I have a page showing Project 123. I then navigate to another page, where I'm able to alter some of the data for Project 123. I then use the Back button to get back to the Project 123 page, but it still shows the old data - making it very clear that the page was not reloaded, but rather was cached.

Worse, there doesn't appear to be any nice event raised in a Page object to indicate that it was just navigated to, so I have no way of forcing a refresh of the data. That'd be too easy I guess...

Explicitly setting KeepAlive to false has no affect. And I didn't think it would - false is supposed to be the default value.

And I have double-checked to make sure my code doesn't keep any reference to any pages. But I don't: I just create a page object in a method using a local variable and navigate to it using the WPF navigation service.


To be very clear, I actually have a single main page that has a Frame control. My content pages are displayed in this Frame, and my navigation is like this:


Which does appear to work in all respects, except that page objects are and aren't cached in memory in ways that defy the docs and any rational logic I can see...

Ideas anyone?

Thursday, 26 April 2007 15:15:23 (Central Standard Time, UTC-06:00)  #    Disclaimer
Aaron Erickson, a Magenic consultant, has been working on an interesting project: providing an indexing service for LINQ. You can get full information about i4o from this blog post, and from the official codeplex site.

You might wonder why this matters, given that LINQ uses database indexes to get its data. But that's actually Dlinq, which runs against SQL Server.

LINQ itself runs against objects, arrays, collections, lists and so forth. All of which are just in-memory objects, and obviously aren't indexed at all. LINQ does "table scans" against arrays and lists at all times. Basically LINQ just runs a lot of for-each loops for you. And in the vast majority of cases that is the right answer, because most lists are only a few score or maybe a few hundred items in length, and using for-each is faster than building an index.

However, you might have lists that are big enough, or where you are doing many repeated queries against the same set of properties, where the cost of building an index is lower than the cost of using simple for-each loops. And this is where the ability to index properties of the objects in a list such that LINQ uses the index becomes very useful.

In any case, check out i4o, because it is interesting and very cool stuff!

Thursday, 26 April 2007 08:33:32 (Central Standard Time, UTC-06:00)  #    Disclaimer
 Tuesday, 24 April 2007

I am building a WPF UI for my ProjectTracker CSLA .NET sample app. On the whole this is going pretty well, and I anticipate being done within the next couple days. I’ve found and fixed a couple bugs in CSLA – one in BusinessListBase that’s been there forever, and one in ValidationPanel that caused a null reference exception. While I fixed that last one, I optimized the code a bit, which does seem to make the control a bit faster.

But one thing I spent a ridiculous amount of time on was the simple process of getting a ComboBox control to bind to one data source to get its list of items, and to the business object property for the key value. Google turned up a number of search results, none of which really addressed this particular scenario – which seems odd to me given how common a scenario it is…

In ProjectTracker, a person (resource) can be assigned to a project. If they are, they are given a role on that project. The Role property is numeric – a key into a name/value list, and a foreign key into the Roles table in the database. In Windows Forms and Web Forms the UI handles translating this numeric value to a human-readable value through ComboBox controls, and obviously WPF can do the same thing. The trick is in figuring out the XAML to make it happen.

Here’s the ComboBox XAML:


              ItemsSource="{Binding Source={StaticResource RoleList}}"



              SelectedValue="{Binding Path=Role}"

              Width="150" />


Let’s break this down.

The ItemsSource property specifies the data source for the data that will populate the display of the control. In my case it is referencing a data provider control defined like this:


    <csla:CslaDataProvider x:Key="RoleList"

                           ObjectType="{x:Type PTracker:RoleList}"


                           IsAsynchronous="False" />



This data provider control loads a name/value list object called RoleList (that inherits from Csla.NameValueListBase). The child objects in this collection expose properties Key and Value.

You can see how the ComboBox uses the DisplayMemberPath to specify that the Value property from the name/value list should be displayed to the user, and the SelectedValuePath specifies that the Key value from the list should be used to select the current item (the Key value is not displayed to the user).

Then notice that the SelectedValue property is used to bind to the main business object. This binding statement sets a path to a property on the overall DataContext for the ComboBox, which in my case is actually set through code at the Page object level:

      this.DataContext = project;

So all controls on the entire page, by default, bind to a Project object, and this includes the ComboBox.

Remember though, that the Role property on the Project is a numeric index value. And so is the Key value from the name/value list. The ComboBox control connects these two automatically. So when the business object’s Role property changes, the ComboBox automatically changes the displayed/selected item. Conversely, when the user changes the ComboBox selected item, that automatically causes the business object’s Role property to change.

Tuesday, 24 April 2007 19:55:13 (Central Standard Time, UTC-06:00)  #    Disclaimer
On this page....
Feed your aggregator (RSS 2.0)
October, 2018 (1)
September, 2018 (3)
August, 2018 (3)
June, 2018 (4)
May, 2018 (1)
April, 2018 (3)
March, 2018 (4)
December, 2017 (1)
November, 2017 (2)
October, 2017 (1)
September, 2017 (3)
August, 2017 (1)
July, 2017 (1)
June, 2017 (1)
May, 2017 (1)
April, 2017 (2)
March, 2017 (1)
February, 2017 (2)
January, 2017 (2)
December, 2016 (5)
November, 2016 (2)
August, 2016 (4)
July, 2016 (2)
June, 2016 (4)
May, 2016 (3)
April, 2016 (4)
March, 2016 (1)
February, 2016 (7)
January, 2016 (4)
December, 2015 (4)
November, 2015 (2)
October, 2015 (2)
September, 2015 (3)
August, 2015 (3)
July, 2015 (2)
June, 2015 (2)
May, 2015 (1)
February, 2015 (1)
January, 2015 (1)
October, 2014 (1)
August, 2014 (2)
July, 2014 (3)
June, 2014 (4)
May, 2014 (2)
April, 2014 (6)
March, 2014 (4)
February, 2014 (4)
January, 2014 (2)
December, 2013 (3)
October, 2013 (3)
August, 2013 (5)
July, 2013 (2)
May, 2013 (3)
April, 2013 (2)
March, 2013 (3)
February, 2013 (7)
January, 2013 (4)
December, 2012 (3)
November, 2012 (3)
October, 2012 (7)
September, 2012 (1)
August, 2012 (4)
July, 2012 (3)
June, 2012 (5)
May, 2012 (4)
April, 2012 (6)
March, 2012 (10)
February, 2012 (2)
January, 2012 (2)
December, 2011 (4)
November, 2011 (6)
October, 2011 (14)
September, 2011 (5)
August, 2011 (3)
June, 2011 (2)
May, 2011 (1)
April, 2011 (3)
March, 2011 (6)
February, 2011 (3)
January, 2011 (6)
December, 2010 (3)
November, 2010 (8)
October, 2010 (6)
September, 2010 (6)
August, 2010 (7)
July, 2010 (8)
June, 2010 (6)
May, 2010 (8)
April, 2010 (13)
March, 2010 (7)
February, 2010 (5)
January, 2010 (9)
December, 2009 (6)
November, 2009 (8)
October, 2009 (11)
September, 2009 (5)
August, 2009 (5)
July, 2009 (10)
June, 2009 (5)
May, 2009 (7)
April, 2009 (7)
March, 2009 (11)
February, 2009 (6)
January, 2009 (9)
December, 2008 (5)
November, 2008 (4)
October, 2008 (7)
September, 2008 (8)
August, 2008 (11)
July, 2008 (11)
June, 2008 (10)
May, 2008 (6)
April, 2008 (8)
March, 2008 (9)
February, 2008 (6)
January, 2008 (6)
December, 2007 (6)
November, 2007 (9)
October, 2007 (7)
September, 2007 (5)
August, 2007 (8)
July, 2007 (6)
June, 2007 (8)
May, 2007 (7)
April, 2007 (9)
March, 2007 (8)
February, 2007 (5)
January, 2007 (9)
December, 2006 (4)
November, 2006 (3)
October, 2006 (4)
September, 2006 (9)
August, 2006 (4)
July, 2006 (9)
June, 2006 (4)
May, 2006 (10)
April, 2006 (4)
March, 2006 (11)
February, 2006 (3)
January, 2006 (13)
December, 2005 (6)
November, 2005 (7)
October, 2005 (4)
September, 2005 (9)
August, 2005 (6)
July, 2005 (7)
June, 2005 (5)
May, 2005 (4)
April, 2005 (7)
March, 2005 (16)
February, 2005 (17)
January, 2005 (17)
December, 2004 (13)
November, 2004 (7)
October, 2004 (14)
September, 2004 (11)
August, 2004 (7)
July, 2004 (3)
June, 2004 (6)
May, 2004 (3)
April, 2004 (2)
March, 2004 (1)
February, 2004 (5)

Powered by: newtelligence dasBlog 2.0.7226.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018, Marimer LLC

Send mail to the author(s) E-mail

Sign In