Silverlight 4.0 返回少于2项时SL4 RIA出错
我不知道我做错了什么,但每当我的服务模型返回的结果少于2个时,我就会得到一个错误 我在silverlight论坛上发问,一点也不高兴 System.ServiceModel.DomainServices.Client.DomainOperationException:查询“GetEmployees”的加载操作失败。意外的文件结尾。以下元素未关闭:LastModifiedDate、Employee、RootResults、GetEmployeesResult、GetEmployeesResponse。-->System.Xml.XmlException:文件意外结束。以下元素未关闭:LastModifiedDate、Employee、RootResults、GetEmployeesResult、GetEmployeesResponse。 位于System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult) 位于System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) 位于System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) ---内部异常堆栈跟踪的结束--- 我的域服务是基本的,如下所示Silverlight 4.0 返回少于2项时SL4 RIA出错,silverlight-4.0,Silverlight 4.0,我不知道我做错了什么,但每当我的服务模型返回的结果少于2个时,我就会得到一个错误 我在silverlight论坛上发问,一点也不高兴 System.ServiceModel.DomainServices.Client.DomainOperationException:查询“GetEmployees”的加载操作失败。意外的文件结尾。以下元素未关闭:LastModifiedDate、Employee、RootResults、GetEmployeesResult、GetEmployeesRespons
[Query(IsDefault = true)]
public IQueryable<Employee> GetEmployees()
{
return this.ObjectContext.Employees.Where(e=>e.IsDeleted==false);
}
<riaControls:DomainDataSource
AutoLoad="True"
x:Name="dsEmployee"
LoadedData="dsEmployee_LoadedData"
SubmittedChanges="dsEmployee_SubmittedChanges"
QueryName="GetEmployees">
<riaControls:DomainDataSource.DomainContext>
<my:MyDomainContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<ListBox
x:Name="lstEmployees"
ItemsSource="{Binding ElementName=dsEmployee, Path=Data}"
Grid.Row="1"
VerticalAlignment="Top"
Height="360" MouseLeftButtonUp="lstEmployees_MouseLeftButtonUp">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
x:Name="stackEmployees"
MouseRightButtonDown="lstEmployees_MouseRightButtonDown">
<TextBlock Text="{Binding EmployeeName}"
Style="{StaticResource RewardGridText}"
Width="220"
TextAlignment="Left">
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu x:Name="ContextMenu"
ItemClick="ContextMenuClick"
Opened="ContextMenuOpened">
<telerik:RadMenuItem Header="Edit" />
<telerik:RadMenuItem Header="Disable" />
<telerik:RadMenuItem Header="Delete" />
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</TextBlock>
<TextBlock Text="{Binding Converter={StaticResource RoleConverter}}" Style="{StaticResource RewardGridText}" Width="160" TextAlignment="Left"/>
<TextBlock Text="{Binding Converter={StaticResource AccountStatusConverter}}" Style="{StaticResource RewardGridText}" Width="160" TextAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
[查询(IsDefault=true)]
公共IQueryable GetEmployees()
{
返回this.ObjectContext.Employees.Where(e=>e.IsDeleted==false);
}
我的xaml看起来像这样
[Query(IsDefault = true)]
public IQueryable<Employee> GetEmployees()
{
return this.ObjectContext.Employees.Where(e=>e.IsDeleted==false);
}
<riaControls:DomainDataSource
AutoLoad="True"
x:Name="dsEmployee"
LoadedData="dsEmployee_LoadedData"
SubmittedChanges="dsEmployee_SubmittedChanges"
QueryName="GetEmployees">
<riaControls:DomainDataSource.DomainContext>
<my:MyDomainContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<ListBox
x:Name="lstEmployees"
ItemsSource="{Binding ElementName=dsEmployee, Path=Data}"
Grid.Row="1"
VerticalAlignment="Top"
Height="360" MouseLeftButtonUp="lstEmployees_MouseLeftButtonUp">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
x:Name="stackEmployees"
MouseRightButtonDown="lstEmployees_MouseRightButtonDown">
<TextBlock Text="{Binding EmployeeName}"
Style="{StaticResource RewardGridText}"
Width="220"
TextAlignment="Left">
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu x:Name="ContextMenu"
ItemClick="ContextMenuClick"
Opened="ContextMenuOpened">
<telerik:RadMenuItem Header="Edit" />
<telerik:RadMenuItem Header="Disable" />
<telerik:RadMenuItem Header="Delete" />
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</TextBlock>
<TextBlock Text="{Binding Converter={StaticResource RoleConverter}}" Style="{StaticResource RewardGridText}" Width="160" TextAlignment="Left"/>
<TextBlock Text="{Binding Converter={StaticResource AccountStatusConverter}}" Style="{StaticResource RewardGridText}" Width="160" TextAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
我的代码绑定正在处理错误。有人知道我接错了什么吗 我在使用Telerik RadCompression和RadUploadModule HttpModule时遇到了相同的问题。我从我的web.config中删除了下面的两行,一切又开始工作了
<add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
<add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" />
我也在使用telerik控件,它也导致了同样的问题。解决这个问题的任务真艰巨,telerik压缩导致了这个问题!!