Silverlight logging out causes "Object reference not set to an instance"
- by Alex
I am using the Silverlight 4 Business Application Template. I've created a DomainDataSource in XAML like so:
<riaControls:DomainDataSource x:Name="LogData" QueryName="GetLogs" AutoLoad="True" LoadSize="20" >
<riaControls:DomainDataSource.DomainContext>
<local:AdminDomainContext />
</riaControls:DomainDataSource.DomainContext>
<riaControls:DomainDataSource.QueryParameters>
<riaControls:Parameter ParameterName="UserLoginID" Value="{Binding Path=User.UserLoginID, Source={StaticResource WebContext}}" />
</riaControls:DomainDataSource.QueryParameters>
</riaControls:DomainDataSource>
The problem I'm experiencing is that whenever I log out, I get:
Load operation failed for query
'GetLogs'. Object reference not set to
an instance of an object.
I assume that because I've logged out, User.UserLoginID is now null and is causing the exception.
So... anybody know a good way for me to solve this? I don't really want to set the QueryParameter programmatically.