Passing GUIDs to the Silverlight CSLADataProvider in Xaml

Passing GUIDs to the Silverlight CSLADataProvider in Xaml

Old forum URL: forums.lhotka.net/forums/t/6535.aspx


SWITCH posted on Saturday, February 28, 2009

Hi All,

I have been unable to figure out how to pass a GUID value to the Silverlight CSLADataProvider in the Xaml for a UserControl. When I specify a FactoryParameter of type System.Guid in the Xaml as follows:

<UserControl ... xmlns:system="clr-namespace:System;assembly=mscorlib">
  <UserControl.Resources>
   
<csla:CslaDataProvider x:Key="BizData" ManageObjectLifetime="True" IsInitialLoadEnabled="False" ObjectType="..." FactoryMethod="GetBizData">
     
<csla:CslaDataProvider.FactoryParameters>
        <system:Guid>54A7CD54-1371-4E9F-A9F0-23E23F5A9518</system:Guid>
      </csla:CslaDataProvider.FactoryParameters>
    </csla:CslaDataProvider>
  </UserControl.Resources>
  ...
</UserControl>

I get the following exception when the UserControl loads:

{System.Windows.Markup.XamlParseException: Unknown element: Guid. [Line: 18 Position: 29]
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at CeCslaAppPrototype.Page.InitializeComponent()
   at CeCslaAppPrototype.Page..ctor()
   at CeCslaAppPrototype.App.Application_Startup(Object sender, StartupEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)}

I can add a Guid FactoryParameter through code no problem. I can't seem to find any examples of anyone doing this so I'm not sure what is causing the problem. Can anyone shed some light on this?

Thanks!

Richard

cds replied on Sunday, March 01, 2009

Just a guess but you might try using curly braces around the GUID - e.g. {54A7CD54-1371-4E9F-A9F0-23E23F5A9518}

SWITCH replied on Sunday, March 01, 2009

Thanks for the suggestion. I did try that, but using curly braces around the Guid resulted in the same problem. I'm sure it's something simple, but I'm not seeing it. I'm stumped at the moment.

Copyright (c) Marimer LLC