Rockford Lhotka's Blog

Home | Lhotka.net | CSLA .NET

 Tuesday, March 31, 2009

CSLA .NET 3.6.2 is now available for download.

This is the second point release of CSLA .NET 3.6, and it includes a number of bug fixes, but more importantly there are a number of new features and enhancements based on feedback from users of version 3.6 over the past four months.

Highlights include:

  • For both Windows and Silverlight
    • New methods on the ObjectFactory base class to better enable creation of a DAL object
    • Better support for lazy loaded fields, where an exception is thrown if the field is mis-used accidentally (thus reducing bugs)
    • ErrorDialog control for WPF and Silverlight to enable XAML-only handling of exceptions from CslaDataProvider
    • CslaDataProvider now has a Saved event to simplify some UI scenarios
    • RegisterProperty() now accepts a lambda expression to identify the property name, allowing the compiler to check the name, and avoiding the use of the string literal
    • MobileDictionary type, so you can create a dictionary that serializes between Silverlight and .NET
  • For Silverlight only
    • Better type name resolution, so you can now specify a type by "Namespace.Class, Assembly" without supplying the generic "Version=..." text
    • New InventoryDemo sample project (C# only right now - it is a work in progress)
    • Code snippets for async factory and data access methods
  •  

    On a related note, the first segment of my CSLA .NET for Silverlight video series is complete, and I’m nearly done with the web infrastructure for the download site. You can get a summary of the video series content on the CSLA .NET for Silverlight video download page.

    Once I get the store and download site complete, you’ll be able to purchase “early adopter'” access to the series – which means you’ll get access to each video segment as soon as it comes online. Look for this in the next couple weeks!

    Tuesday, March 31, 2009 3:59:43 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
     Thursday, March 26, 2009

    Andrew Hallmark, a passionate user of CSLA .NET from the UK, gave a user group presentation introducing CSLA .NET and the presentation was recorded.

    The presentation is available for download from

    http://www.vbug.com/members/pastevents.aspx

    Thank you for sharing your content Andrew!

    Thursday, March 26, 2009 10:01:34 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
     Wednesday, March 25, 2009

    Google tells me that issues with the Silverlight ComboBox control are widespread and well known. It also tells me that there are few solid solutions out there if you want data binding to work with the Silverlight ComboBox in a simple, reliable manner.

    Perhaps the best post on the topic is this one, but this particular code example doesn’t work in all cases (specifically not inside a DataTemplate, and as a form loads and gets async data).

    After wasting more time than I care to consider, I believe I have a more complete solution. Though it isn’t perfect either, it does appear to work nicely with CSLA .NET NameValueListBase objects, and inside DataTemplate elements, which is really what I was after.

    As others have pointed out, the solution is to subclass ComboBox and add SelectedValue and ValueMemberPath properties to the control. The trick is to catch all the edge cases where these new properties, and the pre-existing SelectedItem and Items properties, might change. I may not have them all either, but I think I handle most of them :)

    To use the new control, you need to bring in the namespace containing the control, and then use XAML like this:

    <this:ComboBox Name="ProductCategoryComboBox"
                   ItemsSource="{Binding Source={StaticResource ProductCategories},Path=Data}"
                   SelectedValue="{Binding Path=CategoryId, Mode=TwoWay}"
                   ValueMemberPath="Key"
                   DisplayMemberPath="Value"/>

    At least in my code, you must set the ValueMemberPath, though I’m sure the code could be enhanced to avoid that requirement. The bigger thing is that the SelectedValue binding must have Mode=TwoWay or the binding won’t work reliably. Even if you are using the ComboBox for display-only purposes, the Mode must be TwoWay.

    Also I should point out that this XAML is using the CslaDataProvider control to get the data for the ItemsSource property. You could use other techniques as well, but I like the data provider model because it shifts all the work into XAML, so there’s no code required in the presentation layer. The ProductCategories resource is a CslaDataProvider control that retrieves a NameValueListBase object containing a list of items with Key and Value properties.

    Here’s the control code:

    public class ComboBox : System.Windows.Controls.ComboBox
    {
      public ComboBox()
      {
        this.Loaded += new RoutedEventHandler(ComboBox_Loaded);
        this.SelectionChanged += new SelectionChangedEventHandler(ComboBox_SelectionChanged);
      }

      void ComboBox_Loaded(object sender, RoutedEventArgs e)
      {
        SetSelectionFromValue();
      }

      private object _selection;

      void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
      {
        if (e.AddedItems.Count > 0)
        {
          _selection = e.AddedItems[0];
          SelectedValue = GetMemberValue(_selection);
        }
        else
        {
          _selection = null;
          SelectedValue = null;
        }
      }

      private object GetMemberValue(object item)
      {
        return item.GetType().GetProperty(ValueMemberPath).GetValue(item, null);
      }

      public static DependencyProperty ValueMemberPathProperty =
        DependencyProperty.Register("ValueMemberPath", typeof(string), typeof(InventoryDemo.ComboBox), null);

      public string ValueMemberPath
      {
        get
        {
          return ((string)(base.GetValue(ComboBox.ValueMemberPathProperty)));
        }
        set
        {
          base.SetValue(ComboBox.ValueMemberPathProperty, value);
        }
      }

      public static DependencyProperty SelectedValueProperty =
        DependencyProperty.Register("SelectedValue", typeof(object), typeof(InventoryDemo.ComboBox),
        new PropertyMetadata((o, e) =>
        {
          ((ComboBox)o).SetSelectionFromValue();
        }));

      public object SelectedValue
      {
        get
        {
          return ((object)(base.GetValue(ComboBox.SelectedValueProperty)));
        }
        set
        {
          base.SetValue(ComboBox.SelectedValueProperty, value);
        }
      }

      private void SetSelectionFromValue()
      {
        var value = SelectedValue;
        if (Items.Count > 0 && value != null)
        {
          var sel = (from item in Items
                     where GetMemberValue(item).Equals(value)
                     select item).Single();
          _selection = sel;
          SelectedItem = sel;
        }
      }

      protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
      {
        base.OnItemsChanged(e);
        SetSelectionFromValue();
      }
    }

    It seems strange that the standard control doesn’t just do the right thing – but we must live in the world that is, not the world we would like to see…

    Wednesday, March 25, 2009 10:01:05 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
     Sunday, March 22, 2009

    I have made CSLA .NET 3.6.2 RC0 available for download.

    Version 3.6.2 includes a number of bug fixes, but more importantly includes a number of new features and enhancements based on feedback from users of version 3.6. Highlights include:

  • For both Windows and Silverlight
    • New methods on the ObjectFactory base class to better enable creation of a DAL object
    • Better support for lazy loaded fields, where an exception is thrown if the field is mis-used accidentally (thus reducing bugs)
    • ErrorDialog control for WPF and Silverlight to enable XAML-only handling of exceptions from CslaDataProvider
    • CslaDataProvider now has a Saved event to simplify some UI scenarios
    • RegisterProperty() now accepts a lambda expression to identify the property name, allowing the compiler to check the name, and avoiding the use of the string literal
    • MobileDictionary type, so you can create a dictionary that serializes between Silverlight and .NET
  • For Silverlight only
    • Better type name resolution, so you can now specify a type by "Namespace.Class, Assembly" without supplying the generic "Version=..." text
    • New InventoryDemo sample project (C# only right now - it is a work in progress)
    • Code snippets for async factory and data access methods

    Hopefully this is the final test release of 3.6.2, and I am planning for a final release on March 30 or 31 (before April Fool’s Day :) ). If you are using 3.6.0 or 3.6.1, please download and test this release and let me know if you encounter any issues.

  • Sunday, March 22, 2009 5:33:41 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 

    Many people have asked me for the status of a CSLA .NET for Silverlight ebook. I may yet write such an ebook, but I am trying something new and different first – a 7 part video series covering CSLA .NET for Silverlight.

    Each video will be roughly 40 minutes in length, and the topics include:

    1. Introduction to CSLA .NET for Silverlight
    2. Creating a basic Silverlight and CSLA .NET for Silverlight application
    3. Implementing client-only architectures (calling remote services)
    4. Implementing n-tier archtiectures (using a remote data portal)
    5. Implementation of all CSLA .NET business object stereotypes
    6. Data Access in n-tier applications
    7. Authentication and authorization in CSLA .NET for Silverlight

    This totals to nearly 5 hours of content, with a mix of lecture and demo (though heavy on the demo).

    My current plan is to sell the videos through my online store, allowing purchasers to download the videos so they can be watched offline. The files will be quite large, but once downloaded, you’ll be able to watch them offline and I think that’s preferable to a streaming approach (though I’m open to feedback – would streaming be better?).

    While allowing downloads of the files may invite piracy, I’ll take that risk. I’m sure my ebooks have suffered from some piracy (some people are simply immoral), but I strongly believe that most counter-measures are easily defeated by the criminals and they absolutely complicate the lives of honest customers. The videos will cost more than the ebooks, as I’m basing my pricing on comparable video training, but I am hopeful that this won’t make the piracy issue worse. Unlike stealing from a “big publisher”, a lot of piracy and lack of actual sales just means I won’t be able to afford to create more videos or other content – the linkage between the criminal and me is direct – so I’m hopeful that the “casual pirate” will at least think twice before stealing from the guy who created the framework they are trying to learn :)

    As always though, I believe that most people are basically decent, and that this video series will have very real, tangible value to users of CSLA .NET for Silverlight (and CSLA .NET in general to some degree).

    To create the video series, I’ve hired a video producer and they’ll be doing the editing and production work. They also did all the lighting and camera work to film the live lecture parts of each segment, and what I’ve seen so far looks and sounds very nice! I’m using Camtasia to record the demo parts of each segment, and they’ll merge the lecture and demo content together to create each final segment. The live lecture parts were filmed in one of Magenic’s conference rooms, and I’m pretty pleased with the visual layout (it is somewhat like being in a classroom or at a conference).

    My current train of thought is to offer early adopters a discount, allowing you to download the segments as they become available. I think a discount is warranted, as the segments will be completed over a period of a few weeks, so there’s an element of "paying for future content” involved for any early adopters.

    Watch for the announcement of availability in the next very few short weeks!

    Sunday, March 22, 2009 5:33:34 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
     Friday, March 13, 2009

    I recently did a webcast on CSLA .NET 3.6 through Mike Benkovich’s Benkotips website.

    You can see all Mike’s webcasts, or you can go directly to the CSLA .NET webcast recording.

    This webcast is an overview of CSLA .NET, and includes about 35 minutes of demo where I walk through a CSLA .NET for Silverlight application.

    Friday, March 13, 2009 2:07:58 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
     Thursday, March 12, 2009

    Dunn Training is offering their excellent five day training class on CSLA .NET in San Francisco on May 4-8. They have some seats open, so if you are looking for training on CSLA .NET, and you are near San Francisco (or would like to be :) ), now’s the time to sign up!

    Thursday, March 12, 2009 8:15:23 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 

    When CSLA .NET 3.6.2 is released in a couple weeks, it will be sporting a slightly altered license and copyright notices, with the name Marimer, LLC.

    Marimer, LLC is my shiny new corporate entity, and it is now the owner of all versions of the CSLA .NET framework.

    This doesn’t change the terms of the license, nor should it have any effect on CSLA .NET or anyone’s use of CSLA .NET. It is simply a formal step I felt was necessary to protect myself and my family for legal liability reasons. Honestly, it is something I probably should have done years ago, but it is done now, so I can sleep better at night.

    At the moment I don’t plan to change anything beyond the copyright and ownership statements, and since I have sole control over Marimer, LLC, nothing changes in relation to the continued development of the CSLA .NET framework.

    Thursday, March 12, 2009 5:00:35 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
     Wednesday, March 11, 2009

    I have been working extensively with both WPF and Silverlight over the past many months. Not too long ago, my workstation started having trouble – specifically Visual Studio 2008 was crashing when trying to open XAML files. Not just crashing either; Visual Studio was disappearing in the blink of an eye.

    This started happening every now and then, and became more frequent until it was happening multiple times a day.

    After working with some Microsoft people to try and trace down the problem (which we never really did – as it is hard to attach a debugger or other diagnostic tool to VS after it disappears), they suggested I try this patch:

    https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0

    (the *.msu are for Vista and Server 2008, and *.exe are for XP and Server 2003, and the x86 patch should be used for 64 bit machines too

    Update: For x64 users, you should install the x64 patch, and this will update the 32 bit CLR as part of the installation)

    This patch solved my problem. Just like that.

    Apparently this patch solves a wider set of problems related to stability when editing or working with XAML files in Visual Studio, and is a generally good thing to apply for developers working with WPF and Silverlight.

    Wednesday, March 11, 2009 6:01:23 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
     Monday, March 02, 2009

    I have put a new 3.6.2 release online for Windows and Silverlight. I am considering this a beta release, and am now moving toward final release of 3.6.2.

    Version 3.6.2 contains important bug fixes, and several enhancements to existing features based on feedback from people working with 3.6.1 so far. Highlights of the enhancements include:

    • For both Windows and Silverlight
      • New methods on the ObjectFactory base class to better enable creation of a DAL object
      • Better support for lazy loaded fields, where an exception is thrown if the field is mis-used accidentally (thus reducing bugs)
      • ErrorDialog control for WPF and Silverlight to enable XAML-only handling of exceptions from CslaDataProvider
      • CslaDataProvider now has a Saved event to simplify some UI scenarios
      • RegisterProperty() now accepts a lambda expression to identify the property name, allowing the compiler to check the name, and avoiding the use of the string literal
      • MobileDictionary type, so you can create a dictionary that serializes between Silverlight and .NET
    • For Silverlight only
      • Better type name resolution, so you can now specify a type by "Namespace.Class, Assembly" without supplying the generic "Version=..." text
      • New InventoryDemo sample project (C# only right now - it is a work in progress)
      • Code snippets for async factory and data access methods

    At this point 3.6.2 is feature-complete and is in test mode. Only bug fixes will be added at this point, with the plan being to release in the next couple weeks.

    Monday, March 02, 2009 5:02:52 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 

    My article providing an overview of some of the parallel and concurrent programming features coming in .NET 4.0 is online:

    Parallel and Concurrency Futures for Microsoft Developers

    Monday, March 02, 2009 2:34:11 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
    On this page....
    Search
    Archives
    Feed your aggregator (RSS 2.0)
    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)
    Categories
    About

    Powered by: newtelligence dasBlog 2.0.7226.0

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

    © Copyright 2014, Marimer LLC

    Send mail to the author(s) E-mail



    Sign In