23 noiembrie 2011 15:42
i'm searching for an example regarding sync framework 2.1 where
- n-tier application is developed (meening WCF for the server)
- and dynamic or/and static filtering is also implemented.
Could anyone proivide me a good example documentation or source code?
Here is a similar post: http://social.microsoft.com/Forums/en-US/syncgeneral/thread/78ceb813-dfb0-4502-90fd-96cb143c4c73 , but the answer is very short, no code or documentation is provided.
24 noiembrie 2011 02:07Moderator
have you decided on which database provider to use?
here's two samples using SqlSyncProvider/SqlCeSyncProviders over WCF
if you want the Local Databas Cache generated code, have a look at this:
24 noiembrie 2011 15:16
thanks for the help! I managed to do following things:
- separate client and server side
- connect the client to the WCF service of the server
- syncronize data
What I need now is the filtering. So far i've done following things: (basicly: http://msdn.microsoft.com/en-us/library/ff928701%28v=SQL.110%29.aspx just with sql compact for the client)
- write a separate program to provision the client (sql compact database) and the server
- in the sepatate program I created a filtered scope
- in my main program in the client i managed to execute:
syncOrchestrator = new SampleSyncOrchestrator( new SqlSyncProvider("RetailCustomers", clientSqlConn, null, "Sync"), new SqlSyncProvider("RetailCustomers", serverConn, null, "Sync") ); syncStats = syncOrchestrator.Synchronize();
syncStats says, that I have downloaded one table.
- update my Entity Model based on my sql compast sdf database
How can I do that? I've tried EntityContext.Refresh(StoreWins, entity table), but nothing happended.
Can you help me with this?
Thanks a lot!
24 noiembrie 2011 23:46Moderatorare you just trying to save something to your table? or are you trying to use EF to do the conflict handling?
25 noiembrie 2011 08:56
I have the following tasks with the program:
- create a local database that conatins only a fragment of the server database, so i must use multiple dynamic parameter filters
- use the local database, import data, and syncronize it back to the server
Problems that I could not solve so far:
- I started SyncFramework with the "add new item - local database cash" in VS and created an ADO.NET Entity framework model on it. This works fine, but it provides no filtering. I created code for filtering the database, but then I could not use the Entity model with it. Is it even possible? because if i use filter, only a subset of th tables and data will be available on the client, that means the Entity model would have to be generated dynamicly.
- I did not manage to deprovision the server - it always says, that is it not ywt provisioned. I use this code for provisioning:
SqlSyncScopeProvisioning serverTemplate = new SqlSyncScopeProvisioning(serverConn, scopeDesc, SqlSyncScopeProvisioningType.Template);
serverTemplate.ObjectSchema = shemaName;
- create multiple filters - I only managed to create one filter so far, If i try to create a second one, exception come all over
What do i do wrong?
25 noiembrie 2011 17:22Moderator
the Local Database Cache uses a different set of providers: SqlCeClientSyncProvider/DbServerSyncProvider and is provisioned differently.
the ScopeProvisioning APIs works with SqlSyncProvider/SqlCeSyncProvider.
likewise, Sync Framework does not support dynamic filtering.
you might want to go thru the tutorials in the documentation that comes with the framework or check them online:
25 noiembrie 2011 23:11
Does that mean, that Local Database Cache does not support filternig?
I'd need the easyness of Local Database Cash, with it's WCF suppor combined with filtering.
Is this somehow possible?
If Filtering only works with ScopeProvisioning than how can I achieve that combined with WCF services?
So basicly i'd need an N-Tier applicartion with WCF support with local database cache AND filtering.
26 noiembrie 2011 01:07Moderator
the Local Database Cache Wizard itself doesnt support filtering. but you can modify the code after its generated to add the filters.
if you're using WCF, you will have to add the filter in the WCF service code.
27 noiembrie 2011 11:22
thanks for the help! I've tried your last link, it is also good, but i've found an even simpler and with that it works:
Thanks for your help so far again!
- Marcat ca răspuns de goja15 27 noiembrie 2011 11:22
30 martie 2012 22:16
Here is another complete solution for N tier Sync over WCF,including central portal code for sync configuration..