I have a Web Applicatio, I've created a Service file for Sync, Its Sync Framework CTP 4.0 October
I have a client on Windows Phone 7
Server Code :
public class ForumSyncService : Microsoft.Synchronization.Services.SyncService<ForumOfflineEntities>
{
public static void InitializeService(Microsoft.Synchronization.Services.ISyncServiceConfiguration config)
{
config.ServerConnectionString = NutriLeaf.Services.Constants.Settings.ServerDbConnectionString;
config.SetEnableScope("ForumScope");
config.SetDefaultSyncSerializationFormat(Microsoft.Synchronization.Services.SyncSerializationFormat.ODataJson);
config.SetConflictResolutionPolicy(Microsoft.Synchronization.Services.ConflictResolutionPolicy.ClientWins);
config.EnableDiagnosticPage = true;
config.UseVerboseErrors = true;
config.AddFilterParameterConfiguration("UserID", "ForumThreads", "@UserID", typeof(int));
config.AddFilterParameterConfiguration("UserID", "ForumThreadReplies", "@UserID", typeof(int));
}
}
#endregion
Client Code
static ForumSync.ForumOfflineContext ForumContext = new ForumSync.ForumOfflineContext(Constants.SyncCache.Forums, new Uri(Constants.SyncServices.Forums));
public static void SyncForums()
{
if (UserID == "" || UserID == "0")
{
throw new ArgumentNullException("UserID in setting file not found");
}
ForumContext.CacheController.ControllerBehavior.AddScopeParameters("UserID", "123"); //exception here
ForumContext.CacheController.ControllerBehavior.SerializationFormat = Microsoft.Synchronization.ClientServices.SerializationFormat.ODataJSON;
ForumContext.LoadCompleted += new EventHandler<Microsoft.Synchronization.ClientServices.IsolatedStorage.LoadCompletedEventArgs>(ForumContext_LoadCompleted);
ForumContext.LoadAsync();
}
I get ArgumentException : Value doesnot fall within expected range!
Stack Trace
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(String key, String value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(String key, String value)
at Microsoft.Synchronization.ClientServices.CacheControllerBehavior.AddScopeParameters(String key, String value)
at NutriLeaf.Phone.Sync.NutriLeafSync.SyncForums()
at NutriLeaf.Phone.Pages.Sync.Sync.NutriLeafSync_ArticleSyncCompleted(Object sender, EventArgs e)
at NutriLeaf.Phone.Sync.NutriLeafSync.CacheController_ArticleRefreshCompleted(Object sender, RefreshCompletedEventArgs e)
at Microsoft.Synchronization.ClientServices.CacheController.FireRefreshCompletedEvent(Exception error, Boolean wasCancelled)
at Microsoft.Synchronization.ClientServices.CacheController.RefreshWorkerCompleted(Object error)
at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()
PLEASE HELP!!!
Thank you for your Help!
Nawaz Dhandala