It is necessary to add any Web service special authorization? Alternatively, where the problem could be?
Getting data in Silverlight using the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Data.Services.Client;
using NopCommerceStore.SL.NopSolutionsServiceReference;
namespace NopCommerceStore.SL
{
public partial class MainPage : UserControl
{
private NopSolutionsServiceReference.DataManager dataManager = new NopSolutionsServiceReference.DataManager(new Uri("NopSolutionsServiceReference.svc", UriKind.Relative));
public MainPage()
{
InitializeComponent();
DataServiceQuery<Nop_Banner> query = dataManager.Nop_Banners;
query.BeginExecute(b => { DataServiceQuery<Nop_Banner> state = b.AsyncState as DataServiceQuery<Nop_Banner>;
ObservableCollection<Nop_Banner> data = new ObservableCollection<Nop_Banner>();
foreach (var entity in state.EndExecute(b)) data.Add(entity);
this.bannerGrid.ItemsSource = data;
},query);
}
}
}
In NC1.9 I created a new domain model using Telerik OpenAccess ORM, I use it very often and I have yet to encountered no problem.
WCF contains the following code:
namespace NopSolutions.NopCommerce.Web
{
using System.Data.Services;
/// <summary>
/// SampleServiceName Service Class Handler
/// </summary>
[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public partial class SampleServiceName : DataService<DataManager>
{
/// <summary>
/// Initializes the service.
/// </summary>
/// <param name="config">The config.</param>
public static void InitializeService(IDataServiceConfiguration config)
{
config.SetEntitySetAccessRule("Nop_Banners", EntitySetRights.All);
}
/// <summary>
/// Called when an exception is thrown while processing a request.
/// </summary>
/// <param name="args">Exception arguments.</param>
protected override void HandleException(HandleExceptionArgs args)
{
base.HandleException(args);
}
}
}
I beg you for any comments and suggestions to ensure proper functioning.