Answered by:
Provisioning Problem?

Question
-
Hi, I have a problem using MSF 2.1. I am going to sync MS-SQL server 2008 and SQL compact 3.5. This runs on WCF service.
I am trying to sync 3 tables: roles, users and companies.
Now It works well, but After adding a new column in users table, the new column doesn't work during sync.
"Column 'UserImage' does not belong to table Users." is shown at the statement "SyncOperationStatistics stats = orchestrator.Synchronize();"
But I can view the 'UserImage' in CE database and Sql database.
When adding a new column in any table, same issue is occured.
This is a code snip for provisioning.
DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(str_ScopeName);
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning((SqlConnection)provider.Connection);//determine if this scope already exists on the server and if not go ahead and provision
scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("Roles", (System.Data.SqlClient.SqlConnection)provider.Connection));
if (!serverConfig.ScopeExists(str_ScopeName))
{
scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("Companies", (System.Data.SqlClient.SqlConnection)provider.Connection));
scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("Users", (System.Data.SqlClient.SqlConnection)provider.Connection));
serverConfig.PopulateFromScopeDescription(scopeDesc);
serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
serverConfig.Apply();}
why can't I add a new column? Will be appreciate for any help.
Thanks for your attention.
Best Regards
Thursday, December 30, 2010 3:00 AM
Answers
-
Hi,
Currently SqlSyncProvider doesn't have a easy way to support sync schema change. This is a feature on our plan. The currently supported way is you will need to deprovision the scope and reprovision from scratch. This is not the optimal way but to support schema changes, many things need to be considered for us to release a feature like that.
Thanks.
- Marked as answer by Leonardo Lee Thursday, December 30, 2010 9:33 PM
Thursday, December 30, 2010 6:20 PMAnswerer
All replies
-
Hi,
Currently SqlSyncProvider doesn't have a easy way to support sync schema change. This is a feature on our plan. The currently supported way is you will need to deprovision the scope and reprovision from scratch. This is not the optimal way but to support schema changes, many things need to be considered for us to release a feature like that.
Thanks.
- Marked as answer by Leonardo Lee Thursday, December 30, 2010 9:33 PM
Thursday, December 30, 2010 6:20 PMAnswerer -
Hi, Jin.
Thanks for your reply. So you mean that I have to delete the sync information in SQL server and re-provision?
Best Regards
Thursday, December 30, 2010 9:35 PM -
Yes, you could use SqlSyncScopeDeprovisioning class, details at http://msdn.microsoft.com/en-us/library/microsoft.synchronization.data.sqlserver.sqlsyncscopedeprovisioning(v=SQL.110).aspx. There is also a SqlCeSyncScopeDeprovisioning class at http://msdn.microsoft.com/en-us/library/microsoft.synchronization.data.sqlserverce.sqlcesyncscopedeprovisioning(v=SQL.110).aspx. Thanks.Friday, December 31, 2010 6:00 PMAnswerer
-
Hi, Jin.
Thanks for your kind help.Regards
Saturday, January 1, 2011 1:51 AM -
Hi, Jin
But when provisioning, I lost the Foreign keys and constraints in CE. (I can't view the Foreign key setting up in Ms Sql compact after sync)
How and where can I add the FK constraints? Is it possible to add in provider_ChangesSelected event? If yes, would you like to show me the code snip?
I am using SqlCeSyncProvider for CE.
Best regards.
Monday, January 3, 2011 11:31 AM -
For reference only:
FK discussion at http://social.msdn.microsoft.com/Forums/en-US/syncdevdiscussions/thread/eb309c42-0c2f-442f-8ed0-88557a6f2f05
Wednesday, January 5, 2011 7:09 PMAnswerer