I'm just getting started with sync services and have a question about applying filters that I haven't been able to find an answer to. In VS 2008, I create a local db cache (via Add New Item). I would like to apply a filter before the cache is
filled with data. However, with these options the wizard downloads all the data.
I just follow this URL :
http://msdn.microsoft.com/en-us/library/bb726003.aspx
here i'm getting targetinvocation exception. actually the code is :
using
Microsoft.Synchronization.Data.Server;
using
System.Data.SqlClient;
namespace
LibraryService {
public
partial
class
LibraryCacheServerSyncProvider:
DbServerSyncProvider {
partial
void OnInitialized(){
string connStr = System.Configuration.ConfigurationSettings.AppSettings["ServerLibraryConnectionString"];
SqlConnection serverConn =
new
SqlConnection(connStr);
this.Connection = serverConn;
SqlSyncAdapterBuilder bookBuilder =
new
SqlSyncAdapterBuilder(serverConn);
bookBuilder.TableName =
"Book";
bookBuilder.FilterClause =
"Publication='BPB'";
SyncAdapter bookSyncAdapter = bookBuilder.ToSyncAdapter();
bookSyncAdapter.TableName =
"Book";
this.SyncAdapters.Add(bookSyncAdapter);
}
}
}