├── src
├── Sync Framework Toolkit.chm
├── SyncServiceLib
│ ├── ServiceError.cs
│ ├── Batching
│ │ └── BatchHeader.cs
│ ├── Utility
│ │ └── ODataIdParser.cs
│ ├── SqlProvider
│ │ ├── GetChangesResponse.cs
│ │ ├── ApplyChangesResponse.cs
│ │ ├── provider
│ │ │ └── BatchRangeSetUtil.cs
│ │ └── SqlSyncProviderFilterParameterInfo.cs
│ ├── RequestProcessor
│ │ ├── DelegateBodyWriter.cs
│ │ ├── SyncRequestProcessorBase.cs
│ │ ├── IRequestProcessor.cs
│ │ └── RequestProcessorFactory.cs
│ ├── Error
│ │ ├── Error.cs
│ │ ├── ErrorHandler.cs
│ │ └── HttpStatusCode.cs
│ ├── SyncEntityPropertyIsNullableAttribute.cs
│ ├── SyncConflictContext.cs
│ ├── SyncServiceHostFactory.cs
│ ├── SyncDownloadResponseOperationContext.cs
│ ├── SyncConflictInterceptorAttribute.cs
│ └── SyncResponseInterceptorAttribute.cs
├── tools
│ ├── SyncSvcUtilUI
│ │ ├── Images
│ │ │ ├── CodeGen.png
│ │ │ ├── Placeholder.ico
│ │ │ ├── Placeholder.png
│ │ │ ├── SyncConfig.png
│ │ │ ├── SQL Azure Icon.ico
│ │ │ ├── SQL Azure Icon.png
│ │ │ └── ProvisionDeprovision.png
│ │ ├── app.config
│ │ ├── Properties
│ │ │ ├── Settings.settings
│ │ │ ├── Settings1.Designer.cs
│ │ │ └── AssemblyInfo.cs
│ │ ├── IWizardPage.cs
│ │ ├── Program.cs
│ │ ├── SyncProvisionWizardPages
│ │ │ └── Step2_SummaryOfProvDeProvPage.cs
│ │ ├── SyncConfigWizardPages
│ │ │ └── Step5_SummaryAndFinishPage.cs
│ │ ├── MainForm.cs
│ │ └── CodegenWizardPages
│ │ │ └── Step3_SummaryOfCodegenPage.cs
│ └── SyncSvcUtil
│ │ ├── App.config
│ │ ├── CodeDom
│ │ ├── EntityGenerator.cs
│ │ ├── EntityGeneratorFactory.cs
│ │ └── GenericClientEntityGenerator.cs
│ │ ├── Enums.cs
│ │ ├── Configuration
│ │ ├── FilterColumnConfigElement.cs
│ │ ├── ConfigurationCollectionValidatorAttribute.cs
│ │ ├── ConfigurationCollectionValidator.cs
│ │ ├── SyncConfigurationSection.cs
│ │ └── FilterParameterConfigElement.cs
│ │ └── Properties
│ │ └── AssemblyInfo.cs
├── WP7Client
│ ├── Include
│ │ ├── WP7_CTP_System.Runtime.Serialization.Json.dll
│ │ └── WP7_CTP_System.ComponentModel.DataAnnotations.dll
│ ├── packages.config
│ ├── ExceptionUtility.cs
│ ├── FrameworkSupport
│ │ ├── Initializers.cs
│ │ └── JsonReaderWriterFactory.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── AndroidClient
│ ├── Resources
│ │ ├── Values
│ │ │ └── Strings.xml
│ │ ├── Resource.Designer.cs
│ │ └── AboutResources.txt
│ ├── FrameworkSupport
│ │ ├── ClientWebRequestCreator.cs
│ │ ├── KeyAttribute.cs
│ │ ├── WebRequestCreator.cs
│ │ └── LocalizableString.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── ExceptionUtility.cs
├── iOSClient
│ ├── FrameworkSupport
│ │ ├── ClientWebRequestCreator.cs
│ │ ├── KeyAttribute.cs
│ │ ├── WebRequestCreator.cs
│ │ └── LocalizableString.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── ExceptionUtility.cs
├── Client
│ ├── FrameworkSupport
│ │ ├── XmlBaseReader.cs
│ │ └── JsonReaderWriterFactory.cs
│ ├── ExceptionUtility.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── ClientCommon
│ ├── CacheRequestType.cs
│ ├── IsolatedStorage
│ │ ├── CacheFileType.cs
│ │ ├── IsolatedStorageSyncError.cs
│ │ ├── DownloadResponseData.cs
│ │ ├── IsolatedStorageSyncConflict.cs
│ │ ├── StoreConflictResolutionAction.cs
│ │ ├── LoadCompletedEventArgs.cs
│ │ ├── OfflineEntityState.cs
│ │ ├── Constants.cs
│ │ ├── SyncActiveException.cs
│ │ ├── OfflineEntitySnapshot.cs
│ │ ├── IsolatedStorageSchema.cs
│ │ ├── StoreConflict.cs
│ │ ├── SaveFailedException.cs
│ │ └── AutoResetLock.cs
│ ├── SerializationFormat.cs
│ ├── CacheRequest.cs
│ ├── AsyncWorkManagerException.cs
│ ├── CacheControllerException.cs
│ ├── OfflineSyncProvider.cs
│ ├── RefreshCompletedEventArgs.cs
│ ├── ChangeSet.cs
│ ├── ProcessCacheRequestCompletedEventArgs.cs
│ ├── CacheRefreshStatistics.cs
│ ├── ChangeSetResponse.cs
│ ├── CacheRequestHandler.cs
│ └── AsyncWorkRequest.cs
├── Formatters
│ ├── ReaderItemType.cs
│ ├── JsonHelper.cs
│ ├── JsonElementTypes.cs
│ ├── EntryInfoWrapper.cs
│ └── AtomHelper.cs
├── Common
│ ├── IOfflineEntity.cs
│ ├── Conflict.cs
│ ├── SyncConflict.cs
│ ├── SyncError.cs
│ └── SyncConflictResolution.cs
└── ms_lpl_license_files.txt
├── lib
└── Json.Net
│ ├── WP7
│ └── Newtonsoft.Json.dll
│ └── Portable
│ └── Newtonsoft.Json.dll
├── license.rtf
├── .gitignore
└── README.md
/src/Sync Framework Toolkit.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/Sync Framework Toolkit.chm
--------------------------------------------------------------------------------
/src/SyncServiceLib/ServiceError.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/ServiceError.cs
--------------------------------------------------------------------------------
/lib/Json.Net/WP7/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/lib/Json.Net/WP7/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/lib/Json.Net/Portable/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/lib/Json.Net/Portable/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/SyncServiceLib/Batching/BatchHeader.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/Batching/BatchHeader.cs
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Images/CodeGen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/tools/SyncSvcUtilUI/Images/CodeGen.png
--------------------------------------------------------------------------------
/src/SyncServiceLib/Utility/ODataIdParser.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/Utility/ODataIdParser.cs
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Images/Placeholder.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/tools/SyncSvcUtilUI/Images/Placeholder.ico
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Images/Placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/tools/SyncSvcUtilUI/Images/Placeholder.png
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Images/SyncConfig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/tools/SyncSvcUtilUI/Images/SyncConfig.png
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Images/SQL Azure Icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/tools/SyncSvcUtilUI/Images/SQL Azure Icon.ico
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Images/SQL Azure Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/tools/SyncSvcUtilUI/Images/SQL Azure Icon.png
--------------------------------------------------------------------------------
/src/SyncServiceLib/SqlProvider/GetChangesResponse.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/SqlProvider/GetChangesResponse.cs
--------------------------------------------------------------------------------
/src/SyncServiceLib/SqlProvider/ApplyChangesResponse.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/SqlProvider/ApplyChangesResponse.cs
--------------------------------------------------------------------------------
/src/SyncServiceLib/RequestProcessor/DelegateBodyWriter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/RequestProcessor/DelegateBodyWriter.cs
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Images/ProvisionDeprovision.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/tools/SyncSvcUtilUI/Images/ProvisionDeprovision.png
--------------------------------------------------------------------------------
/src/SyncServiceLib/SqlProvider/provider/BatchRangeSetUtil.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/SqlProvider/provider/BatchRangeSetUtil.cs
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/SyncServiceLib/RequestProcessor/SyncRequestProcessorBase.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/RequestProcessor/SyncRequestProcessorBase.cs
--------------------------------------------------------------------------------
/src/WP7Client/Include/WP7_CTP_System.Runtime.Serialization.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/WP7Client/Include/WP7_CTP_System.Runtime.Serialization.Json.dll
--------------------------------------------------------------------------------
/src/SyncServiceLib/SqlProvider/SqlSyncProviderFilterParameterInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/SyncServiceLib/SqlProvider/SqlSyncProviderFilterParameterInfo.cs
--------------------------------------------------------------------------------
/src/WP7Client/Include/WP7_CTP_System.ComponentModel.DataAnnotations.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmeints/SyncFrameworkToolkit/HEAD/src/WP7Client/Include/WP7_CTP_System.ComponentModel.DataAnnotations.dll
--------------------------------------------------------------------------------
/src/AndroidClient/Resources/Values/Strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, Click Me!
4 | $projectname$
5 |
6 |
--------------------------------------------------------------------------------
/src/iOSClient/FrameworkSupport/ClientWebRequestCreator.cs:
--------------------------------------------------------------------------------
1 | namespace System.Net.Browser
2 | {
3 | internal class ClientHttpWebRequestCreator : IWebRequestCreate
4 | {
5 | public WebRequest Create(Uri uri)
6 | {
7 | return WebRequest.CreateHttp(uri);
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/AndroidClient/FrameworkSupport/ClientWebRequestCreator.cs:
--------------------------------------------------------------------------------
1 | namespace System.Net.Browser
2 | {
3 | internal class ClientHttpWebRequestCreator : IWebRequestCreate
4 | {
5 | public WebRequest Create(Uri uri)
6 | {
7 | return WebRequest.CreateHttp(uri);
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/WP7Client/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/license.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 MS Shell Dlg;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs16\f2\cf0 \cf0\ql{\f2 {\ltrch The client-side source code in the package is released under the Apache 2.0 license and the server-side source code under the MS-LPL license.}\li0\ri0\sa0\sb0\fi0\ql\par}
2 | }
3 | }
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Client/FrameworkSupport/XmlBaseReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Documents;
6 | using System.Windows.Ink;
7 | using System.Windows.Input;
8 | using System.Windows.Media;
9 | using System.Windows.Media.Animation;
10 | using System.Windows.Shapes;
11 |
12 | namespace Microsoft.Synchronization.ClientServices.FrameworkSupport
13 | {
14 | public class XmlBaseReader
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/iOSClient/FrameworkSupport/KeyAttribute.cs:
--------------------------------------------------------------------------------
1 | // Type: System.ComponentModel.DataAnnotations.KeyAttribute
2 | // Assembly: System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
3 | // Assembly location: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll
4 |
5 | using System;
6 | using System.Runtime;
7 |
8 | namespace System.ComponentModel.DataAnnotations
9 | {
10 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
11 | public sealed class KeyAttribute : Attribute
12 | {
13 | public KeyAttribute()
14 | {
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/AndroidClient/FrameworkSupport/KeyAttribute.cs:
--------------------------------------------------------------------------------
1 | // Type: System.ComponentModel.DataAnnotations.KeyAttribute
2 | // Assembly: System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
3 | // Assembly location: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll
4 |
5 | using System;
6 | using System.Runtime;
7 |
8 | namespace System.ComponentModel.DataAnnotations
9 | {
10 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
11 | public sealed class KeyAttribute : Attribute
12 | {
13 | public KeyAttribute()
14 | {
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/ClientCommon/CacheRequestType.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | enum CacheRequestType
23 | {
24 | UploadChanges,
25 | DownloadChanges
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/IWizardPage.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace SyncSvcUtilUI
21 | {
22 | interface IWizardPage
23 | {
24 | void OnFocus();
25 | bool OnMovingNext();
26 | void OnFinish();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/CacheFileType.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
16 | {
17 | internal enum CacheFileType
18 | {
19 | DownloadResponse,
20 | SaveChanges,
21 | UploadResponse,
22 | Conflicts,
23 | Errors,
24 | Archive,
25 | Unknown
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Formatters/ReaderItemType.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.Services.Formatters
21 | {
22 | enum ReaderItemType
23 | {
24 | BOF,
25 | Entry,
26 | SyncBlob,
27 | HasMoreChanges,
28 | EOF
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Formatters/JsonHelper.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Xml;
17 |
18 | namespace Microsoft.Synchronization.Services.Formatters
19 | {
20 | static class JsonHelper
21 | {
22 | public static bool IsElement(XmlReader reader, string elementName)
23 | {
24 | return reader.Name.Equals(elementName, StringComparison.InvariantCulture);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Formatters/JsonElementTypes.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 |
16 | namespace Microsoft.Synchronization.Services.Formatters
17 | {
18 | static class JsonElementTypes
19 | {
20 | public const string Object = "object";
21 | public const string Array = "array";
22 | public const string String = "string";
23 | public const string Number = "number";
24 | public const string Null = "null";
25 | public const string Boolean = "boolean";
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/AndroidClient/FrameworkSupport/WebRequestCreator.cs:
--------------------------------------------------------------------------------
1 | namespace System.Net.Browser
2 | {
3 | ///
4 | /// Provides objects for specifying whether the browser or the client handles HTTP requests and responses.
5 | ///
6 | public static class WebRequestCreator
7 | {
8 | private static IWebRequestCreate s_clientHttp;
9 |
10 | ///
11 | /// Gets an object that specifies client HTTP handling for Web requests and responses.
12 | ///
13 | ///
14 | ///
15 | /// An object for use with Silverlight-based application that runs outside of a Web browser.
16 | ///
17 | public static IWebRequestCreate ClientHttp
18 | {
19 | get
20 | {
21 | if (WebRequestCreator.s_clientHttp == null)
22 | WebRequestCreator.s_clientHttp = (IWebRequestCreate)new ClientHttpWebRequestCreator();
23 | return WebRequestCreator.s_clientHttp;
24 | }
25 | }
26 |
27 | static WebRequestCreator()
28 | {
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/iOSClient/FrameworkSupport/WebRequestCreator.cs:
--------------------------------------------------------------------------------
1 | namespace System.Net.Browser
2 | {
3 | ///
4 | /// Provides objects for specifying whether the browser or the client handles HTTP requests and responses.
5 | ///
6 | public static class WebRequestCreator
7 | {
8 | private static IWebRequestCreate s_clientHttp;
9 |
10 | ///
11 | /// Gets an object that specifies client HTTP handling for Web requests and responses.
12 | ///
13 | ///
14 | ///
15 | /// An object for use with Silverlight-based application that runs outside of a Web browser.
16 | ///
17 | public static IWebRequestCreate ClientHttp
18 | {
19 | get
20 | {
21 | if (WebRequestCreator.s_clientHttp == null)
22 | WebRequestCreator.s_clientHttp = (IWebRequestCreate)new ClientHttpWebRequestCreator();
23 | return WebRequestCreator.s_clientHttp;
24 | }
25 | }
26 |
27 | static WebRequestCreator()
28 | {
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Properties/Settings1.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.235
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SyncSvcUtilUI.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Common/IOfflineEntity.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | #if SERVER
16 | namespace Microsoft.Synchronization.Services
17 | #elif CLIENT
18 | namespace Microsoft.Synchronization.ClientServices
19 | #endif
20 | {
21 | ///
22 | /// Represents the base interface that all offline cacheable object should derive from.
23 | ///
24 | public interface IOfflineEntity
25 | {
26 | ///
27 | /// Represents the sync and OData metadata used for the entity
28 | ///
29 | OfflineEntityMetadata ServiceMetadata { get; set; }
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/IsolatedStorageSyncError.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
18 | {
19 | internal class IsolatedStorageSyncError : SyncError
20 | {
21 | public IsolatedStorageSyncError(SyncError error)
22 | {
23 | this.LiveEntity = error.LiveEntity;
24 | this.ErrorEntity = error.ErrorEntity;
25 | this.Description = error.Description;
26 | }
27 |
28 | internal string FileName
29 | {
30 | get;
31 | set;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/ClientCommon/SerializationFormat.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Represents the serialization format between the client and the server
24 | ///
25 | public enum SerializationFormat
26 | {
27 | ///
28 | /// ATOM Format
29 | ///
30 | ODataAtom,
31 |
32 | ///
33 | /// JSON Format
34 | ///
35 | ODataJSON
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/ClientCommon/CacheRequest.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Net;
17 | using System.Collections.Generic;
18 |
19 | namespace Microsoft.Synchronization.ClientServices
20 | {
21 | ///
22 | /// Wrapper Class representing all the related information about an Sync request
23 | ///
24 | class CacheRequest
25 | {
26 | public Guid RequestId;
27 | public ICollection Changes;
28 | public CacheRequestType RequestType;
29 | public SerializationFormat Format;
30 | public byte[] KnowledgeBlob;
31 | public bool IsLastBatch;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/DownloadResponseData.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Runtime.Serialization;
18 |
19 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
20 | {
21 | [DataContract()]
22 | internal class ResponseData
23 | {
24 | [DataMember()]
25 | public byte[] Anchor
26 | {
27 | get;
28 | set;
29 | }
30 |
31 | [DataMember()]
32 | public IEnumerable Entities
33 | {
34 | get;
35 | set;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/IsolatedStorageSyncConflict.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
18 | {
19 | internal class IsolatedStorageSyncConflict : SyncConflict
20 | {
21 | public IsolatedStorageSyncConflict(SyncConflict conflict)
22 | {
23 | this.LiveEntity = conflict.LiveEntity;
24 | this.LosingEntity = conflict.LosingEntity;
25 | this.Resolution = conflict.Resolution;
26 | }
27 |
28 | internal string FileName
29 | {
30 | get;
31 | set;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/CodeDom/EntityGenerator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.CodeDom;
20 | using Microsoft.Synchronization.Data;
21 | using System.IO;
22 |
23 | namespace Microsoft.Synchronization.ClientServices.CodeDom
24 | {
25 | abstract class EntityGenerator
26 | {
27 | public abstract void GenerateEntities(string filePrefix, string nameSpace, DbSyncScopeDescription desc, Dictionary> colsMappingInfo,
28 | DirectoryInfo dirInfo, CodeLanguage option, string serviceUri);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/ClientCommon/AsyncWorkManagerException.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Exception thrown for invalid operations in the AsyncWorkerManager.
24 | ///
25 | class AsyncWorkManagerException : Exception
26 | {
27 | public AsyncWorkManagerException(string message)
28 | : base(message)
29 | { }
30 |
31 | public AsyncWorkManagerException(string message, Exception innerException)
32 | : base(message, innerException)
33 | { }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/AndroidClient/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("AndroidClient")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("AndroidClient")]
14 | [assembly: AssemblyCopyright("Copyright © 2013")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 |
32 | // Add some common permissions, these can be removed if not needed
33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
35 |
--------------------------------------------------------------------------------
/src/AndroidClient/Resources/Resource.Designer.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable 1591
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.18033
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | [assembly: Android.Runtime.ResourceDesignerAttribute("Microsoft.Synchronization.ClientServices.Resource", IsApplication=false)]
13 |
14 | namespace Microsoft.Synchronization.ClientServices
15 | {
16 |
17 |
18 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
19 | public partial class Resource
20 | {
21 |
22 | Resource()
23 | {
24 | global::Android.Runtime.ResourceIdManager.UpdateIdValues ();
25 | }
26 |
27 | public partial class Attribute
28 | {
29 |
30 | private Attribute()
31 | {
32 | }
33 | }
34 |
35 | public partial class String
36 | {
37 |
38 | // aapt resource value: 0x7f020001
39 | public static int ApplicationName = 2130837505;
40 |
41 | // aapt resource value: 0x7f020000
42 | public static int Hello = 2130837504;
43 |
44 | private String()
45 | {
46 | }
47 | }
48 | }
49 | }
50 | #pragma warning restore 1591
51 |
--------------------------------------------------------------------------------
/src/Common/Conflict.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Runtime.Serialization;
16 | #if SERVER
17 | namespace Microsoft.Synchronization.Services
18 | #elif CLIENT
19 | namespace Microsoft.Synchronization.ClientServices
20 | #endif
21 | {
22 | ///
23 | /// Represents a Conflict base type.
24 | ///
25 | [DataContract()]
26 | public class Conflict
27 | {
28 | ///
29 | /// Represents the current live version that is stored on the server. The version when applied on
30 | /// the client will ensure data convergence between server and client for this particular
31 | /// entity.
32 | ///
33 | [DataMember]
34 | public IOfflineEntity LiveEntity { get; internal set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Client/ExceptionUtility.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Threading;
17 | using System.Runtime.InteropServices;
18 | using System.Reflection;
19 |
20 |
21 | namespace Microsoft.Synchronization.ClientServices
22 | {
23 | static class ExceptionUtility
24 | {
25 | internal static bool IsFatal(Exception exception)
26 | {
27 | while (exception != null)
28 | {
29 | if (exception is OutOfMemoryException || exception is ThreadAbortException || exception is AccessViolationException || exception is SEHException)
30 | {
31 | return true;
32 | }
33 | exception = exception.InnerException;
34 | }
35 | return false;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Common/SyncConflict.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | #if SERVER
16 | namespace Microsoft.Synchronization.Services
17 | #elif CLIENT
18 | namespace Microsoft.Synchronization.ClientServices
19 | #endif
20 | {
21 | ///
22 | /// Represents a Synchronization related Conflict that was raised and handled on the server.
23 | ///
24 | public class SyncConflict : Conflict
25 | {
26 | ///
27 | /// This represents the version of the Entity that lost in the conflict resolution.
28 | ///
29 | public IOfflineEntity LosingEntity { get; set; }
30 |
31 | ///
32 | /// This represents the Conflict resolution policy that was applied
33 | ///
34 | public SyncConflictResolution Resolution { get; set;}
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Common/SyncError.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | #if SERVER
16 | namespace Microsoft.Synchronization.Services
17 | #elif CLIENT
18 | namespace Microsoft.Synchronization.ClientServices
19 | #endif
20 | {
21 | ///
22 | /// Represents a Synchronization related backend store error that was raised and handled on the server.
23 | ///
24 | public class SyncError : Conflict
25 | {
26 | ///
27 | /// Represents a copy of the Client Entity that raised the error on the server.
28 | ///
29 | public IOfflineEntity ErrorEntity { get; set; }
30 |
31 | ///
32 | /// The description as sent by the sync service explaining the reason for the error.
33 | ///
34 | public string Description { get; internal set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/iOSClient/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("iOSClient")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("iOSClient")]
13 | [assembly: AssemblyCopyright("Copyright © 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f0655358-4457-4094-9a42-062be5acd8a3")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/WP7Client/ExceptionUtility.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Threading;
17 | using System.Runtime.InteropServices;
18 | using System.Reflection;
19 |
20 |
21 | namespace Microsoft.Synchronization.ClientServices
22 | {
23 | static class ExceptionUtility
24 | {
25 | internal static bool IsFatal(Exception exception)
26 | {
27 | while (exception != null)
28 | {
29 | if (exception is OutOfMemoryException || exception is ThreadAbortException || exception is AccessViolationException
30 | #if !WPCLIENT
31 | || exception is SEHException
32 | #endif
33 | )
34 | {
35 | return true;
36 | }
37 | exception = exception.InnerException;
38 | }
39 | return false;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/iOSClient/ExceptionUtility.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Threading;
17 | using System.Runtime.InteropServices;
18 | using System.Reflection;
19 |
20 |
21 | namespace Microsoft.Synchronization.ClientServices
22 | {
23 | static class ExceptionUtility
24 | {
25 | internal static bool IsFatal(Exception exception)
26 | {
27 | while (exception != null)
28 | {
29 | if (exception is OutOfMemoryException || exception is ThreadAbortException || exception is AccessViolationException
30 | #if !WPCLIENT
31 | || exception is SEHException
32 | #endif
33 | )
34 | {
35 | return true;
36 | }
37 | exception = exception.InnerException;
38 | }
39 | return false;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/AndroidClient/ExceptionUtility.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Threading;
17 | using System.Runtime.InteropServices;
18 | using System.Reflection;
19 |
20 |
21 | namespace Microsoft.Synchronization.ClientServices
22 | {
23 | static class ExceptionUtility
24 | {
25 | internal static bool IsFatal(Exception exception)
26 | {
27 | while (exception != null)
28 | {
29 | if (exception is OutOfMemoryException || exception is ThreadAbortException || exception is AccessViolationException
30 | #if !WPCLIENT
31 | || exception is SEHException
32 | #endif
33 | )
34 | {
35 | return true;
36 | }
37 | exception = exception.InnerException;
38 | }
39 | return false;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Common/SyncConflictResolution.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | #if SERVER
21 | namespace Microsoft.Synchronization.Services
22 | #elif CLIENT
23 | namespace Microsoft.Synchronization.ClientServices
24 | #endif
25 | {
26 | ///
27 | /// Represents the resolution that the server employed to resolve a conflict.
28 | ///
29 | public enum SyncConflictResolution
30 | {
31 | ///
32 | /// Client version was ignored.
33 | ///
34 | ServerWins,
35 |
36 | ///
37 | /// Server version was ignored.
38 | ///
39 | ClientWins,
40 |
41 | ///
42 | /// Changes from both server and client version were merged
43 | ///
44 | Merge
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Windows.Forms;
19 |
20 | namespace SyncSvcUtilUI
21 | {
22 | static class Program
23 | {
24 | ///
25 | /// The main entry point for the application.
26 | ///
27 | [STAThread]
28 | static void Main()
29 | {
30 | try
31 | {
32 | Application.EnableVisualStyles();
33 | Application.SetCompatibleTextRenderingDefault(false);
34 | Application.Run(new MainForm());
35 | }
36 | catch (Exception exp)
37 | {
38 | MessageBox.Show("Something unexpected happened." +
39 | exp.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/StoreConflictResolutionAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
18 | {
19 | ///
20 | /// Enumerator which represents the resolution actions which are available for store conflicts.
21 | /// There are only two choices, AcceptStoreEntity or AcceptModifiedEntity. If a merge resolution
22 | /// is desired, the ModifiedEntity of the StoreConflict should be changed, and the AcceptModifiedEntity
23 | /// should be called.
24 | ///
25 | public enum StoreConflictResolutionAction
26 | {
27 | ///
28 | /// Accept the store version of the entity, rolling back changes to the modified entity.
29 | ///
30 | AcceptStoreEntity,
31 |
32 | ///
33 | /// Accept the modified entity, allowing it to be saved.
34 | ///
35 | AcceptModifiedEntity
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/LoadCompletedEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
18 | {
19 | ///
20 | /// Event args passed to the LoadCompletedEventHandler when LoadAsync completes
21 | ///
22 | public class LoadCompletedEventArgs : EventArgs
23 | {
24 | ///
25 | /// Constructor which takes the exception that occurred when loading. The exception
26 | /// can be null if no exception occurred
27 | ///
28 | /// Exception which occurred during loading (can be null).
29 | public LoadCompletedEventArgs(Exception e)
30 | {
31 | this._exception = e;
32 | }
33 |
34 | ///
35 | /// The exception that occurred during execution of LoadAsync.
36 | ///
37 | public Exception Exception
38 | {
39 | get
40 | {
41 | return _exception;
42 | }
43 | }
44 |
45 | Exception _exception;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/AndroidClient/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.xml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable-hdpi/
12 | icon.png
13 |
14 | drawable-ldpi/
15 | icon.png
16 |
17 | drawable-mdpi/
18 | icon.png
19 |
20 | layout/
21 | main.xml
22 |
23 | values/
24 | strings.xml
25 |
26 | In order to get the build system to recognize Android resources, set the build action to
27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
28 | instead operate on resource IDs. When you compile an Android application that uses resources,
29 | the build system will package the resources for distribution and generate a class called
30 | "Resource" that contains the tokens for each one of the resources included. For example,
31 | for the above Resources layout, this is what the Resource class would expose:
32 |
33 | public class Resource {
34 | public class drawable {
35 | public const int icon = 0x123;
36 | }
37 |
38 | public class layout {
39 | public const int main = 0x456;
40 | }
41 |
42 | public class strings {
43 | public const int first_string = 0xabc;
44 | public const int second_string = 0xbcd;
45 | }
46 | }
47 |
48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50 | string in the dictionary file values/strings.xml.
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/OfflineEntityState.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 |
16 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
17 | {
18 | ///
19 | /// The various states an entity can have. They are as follows:
20 | /// Detached - The entity has been created outside of the context and has not been added.
21 | /// Unmodified - The entity has been received or sent during sync and has not been modified since
22 | /// Modified - The entity has been updated, created, or deleted, but not saved.
23 | /// Saved - The entity has been modified and saved.
24 | ///
25 | public enum OfflineEntityState
26 | {
27 | ///
28 | /// State when the entity is deleted. The instance referred by the app is set to Detached
29 | ///
30 | Detached,
31 | ///
32 | /// Represents the state of the entity before its modified by the app
33 | ///
34 | Unmodified,
35 | ///
36 | /// Represents the state of the entity when its modified
37 | ///
38 | Modified,
39 | ///
40 | /// Represents the state of the entity after it is saved
41 | ///
42 | Saved
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/CodeDom/EntityGeneratorFactory.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices.CodeDom
21 | {
22 | class EntityGeneratorFactory
23 | {
24 | ///
25 | /// Create a new instance of EntityGenerator implementation.
26 | ///
27 | /// Target for which to generate code.
28 | /// Schema under which the sync related objects are created in the SQL database.
29 | /// This can be null when generating non-server code.
30 | ///
31 | public static EntityGenerator Create(CodeGenTarget target, string syncObjectSchema)
32 | {
33 | switch (target)
34 | {
35 | case CodeGenTarget.Server:
36 | default:
37 | return new ServiceEntityGenerator(syncObjectSchema);
38 | case CodeGenTarget.ISClient:
39 | return new IsolatedStoreClientEntityGenerator();
40 | case CodeGenTarget.Client:
41 | return new GenericClientEntityGenerator();
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/WP7Client/FrameworkSupport/Initializers.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IXmlJsonWriterInitializer.cs
3 | //
4 | // Author:
5 | // Atsushi Enomoto
6 | //
7 | // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining
10 | // a copy of this software and associated documentation files (the
11 | // "Software"), to deal in the Software without restriction, including
12 | // without limitation the rights to use, copy, modify, merge, publish,
13 | // distribute, sublicense, and/or sell copies of the Software, and to
14 | // permit persons to whom the Software is furnished to do so, subject to
15 | // the following conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 | using System;
29 | using System.Collections.Generic;
30 | using System.Globalization;
31 | using System.IO;
32 | using System.Text;
33 | using System.Xml;
34 |
35 | namespace System.Runtime.Serialization.Json
36 | {
37 | public interface IXmlJsonWriterInitializer
38 | {
39 | void SetOutput(Stream stream, Encoding encoding, bool ownsStream);
40 | }
41 |
42 | public interface IXmlJsonReaderInitializer
43 | {
44 | void SetInput(byte[] buffer, int offset, int count, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose);
45 |
46 | void SetInput(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose);
47 | }
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | [Bb]in/
3 | [Oo]bj/
4 |
5 | # mstest test results
6 | TestResults
7 |
8 | ## Ignore Visual Studio temporary files, build results, and
9 | ## files generated by popular Visual Studio add-ons.
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.sln.docstates
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Rr]elease/
19 | x64/
20 | *_i.c
21 | *_p.c
22 | *.ilk
23 | *.meta
24 | *.obj
25 | *.pch
26 | *.pdb
27 | *.pgc
28 | *.pgd
29 | *.rsp
30 | *.sbr
31 | *.tlb
32 | *.tli
33 | *.tlh
34 | *.tmp
35 | *.log
36 | *.vspscc
37 | *.vssscc
38 | .builds
39 |
40 | # Visual C++ cache files
41 | ipch/
42 | *.aps
43 | *.ncb
44 | *.opensdf
45 | *.sdf
46 |
47 | # Visual Studio profiler
48 | *.psess
49 | *.vsp
50 | *.vspx
51 |
52 | # Guidance Automation Toolkit
53 | *.gpState
54 |
55 | # ReSharper is a .NET coding add-in
56 | _ReSharper*
57 |
58 | # NCrunch
59 | *.ncrunch*
60 | .*crunch*.local.xml
61 |
62 | # Installshield output folder
63 | [Ee]xpress
64 |
65 | # DocProject is a documentation generator add-in
66 | DocProject/buildhelp/
67 | DocProject/Help/*.HxT
68 | DocProject/Help/*.HxC
69 | DocProject/Help/*.hhc
70 | DocProject/Help/*.hhk
71 | DocProject/Help/*.hhp
72 | DocProject/Help/Html2
73 | DocProject/Help/html
74 |
75 | # Click-Once directory
76 | publish
77 |
78 | # Publish Web Output
79 | *.Publish.xml
80 |
81 | # NuGet Packages Directory
82 | packages
83 |
84 | # Windows Azure Build Output
85 | csx
86 | *.build.csdef
87 |
88 | # Windows Store app package directory
89 | AppPackages/
90 |
91 | # Others
92 | [Bb]in
93 | [Oo]bj
94 | sql
95 | TestResults
96 | [Tt]est[Rr]esult*
97 | *.Cache
98 | ClientBin
99 | [Ss]tyle[Cc]op.*
100 | ~$*
101 | *.dbmdl
102 | Generated_Code #added for RIA/Silverlight projects
103 |
104 | # Backup & report files from converting an old project file to a newer
105 | # Visual Studio version. Backup files are not needed, because we have git ;-)
106 | _UpgradeReport_Files/
107 | Backup*/
108 | UpgradeLog*.XML
109 |
--------------------------------------------------------------------------------
/src/ClientCommon/CacheControllerException.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Custom exception for any CacheController related invalid operations.
24 | ///
25 | public class CacheControllerException : Exception
26 | {
27 | ///
28 | /// CacheControllerException ctor
29 | ///
30 | ///
31 | public CacheControllerException(string message)
32 | : base(message)
33 | {
34 | }
35 |
36 | ///
37 | /// CacheControllerException ctor
38 | ///
39 | ///
40 | ///
41 | public CacheControllerException(string message, Exception inner)
42 | : base(message, inner)
43 | { }
44 |
45 | ///
46 | /// CacheControllerException ctor
47 | ///
48 | public CacheControllerException()
49 | : base()
50 | { }
51 |
52 | internal static CacheControllerException CreateCacheBusyException()
53 | {
54 | return new CacheControllerException("Cannot complete WebRequest as another Refresh() operation is in progress.");
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/Constants.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Text.RegularExpressions;
16 |
17 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
18 | {
19 | ///
20 | /// Contains contants used by the context
21 | ///
22 | internal static class Constants
23 | {
24 | // File name used for storing scopeName info
25 | public static readonly string SCOPE_INFO = "scopeinfo";
26 |
27 | // File name used for lock for the cache path
28 | public static readonly string LOCKFILE = "lock";
29 |
30 | private static readonly Regex regex = new Regex("^[a-fA-F0-9]{8}[.]((-?[0-9]+[.][CE])|([ADSU]))$");
31 |
32 | public static readonly long TIMER_INTERVAL = 5 * 60 * 1000;
33 |
34 |
35 | // Returns whether or not the requested file is one of the special files.
36 | public static bool SpecialFile(string fileName)
37 | {
38 | if (fileName == SCOPE_INFO)
39 | {
40 | return true;
41 | }
42 | else if (fileName == LOCKFILE)
43 | {
44 | return true;
45 | }
46 |
47 | return false;
48 | }
49 |
50 | // Returns whether or not the file name is one of ours.
51 | public static bool IsCacheFile(string fileName)
52 | {
53 | return regex.IsMatch(fileName);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/WP7Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Reflection;
16 | using System.Runtime.CompilerServices;
17 | using System.Runtime.InteropServices;
18 |
19 | // General Information about an assembly is controlled through the following
20 | // set of attributes. Change these attribute values to modify the information
21 | // associated with an assembly.
22 | [assembly: AssemblyTitle("WP7Client")]
23 | [assembly: AssemblyDescription("")]
24 | [assembly: AssemblyConfiguration("")]
25 | [assembly: AssemblyCompany("Microsoft")]
26 | [assembly: AssemblyProduct("WP7Client")]
27 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
28 | [assembly: AssemblyTrademark("")]
29 | [assembly: AssemblyCulture("")]
30 |
31 | // Setting ComVisible to false makes the types in this assembly not visible
32 | // to COM components. If you need to access a type in this assembly from
33 | // COM, set the ComVisible attribute to true on that type.
34 | [assembly: ComVisible(false)]
35 |
36 | // The following GUID is for the ID of the typelib if this project is exposed to COM
37 | [assembly: Guid("4b494cbd-3b70-4aab-b4cf-f827066a1a6a")]
38 |
39 | // Version information for an assembly consists of the following four values:
40 | //
41 | // Major Version
42 | // Minor Version
43 | // Build Number
44 | // Revision
45 | //
46 | // You can specify all the values or you can default the Revision and Build Numbers
47 | // by using the '*' as shown below:
48 | [assembly: AssemblyVersion("1.0.0.0")]
49 | [assembly: AssemblyFileVersion("1.0.0.0")]
50 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/Enums.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Represents the various operation modes supported by SyncSvcUtil.exe
24 | /// Maps to the /mode param
25 | ///
26 | enum OperationMode
27 | {
28 | Provision,
29 | Deprovision,
30 | Codegen
31 | }
32 |
33 | ///
34 | /// Represents the various code generation language options supported by SyncSvcUtil.exe
35 | /// Maps to /language param
36 | ///
37 | enum CodeLanguage
38 | {
39 | CS,
40 | VB,
41 | SVC
42 | }
43 |
44 | ///
45 | /// Represents the mode (server/client/isclient) for which the entities supported by SyncSvcUtil.exe.
46 | /// Maps to the /target param.
47 | ///
48 | enum CodeGenTarget
49 | {
50 | Server,
51 | ISClient,
52 | Client
53 | }
54 |
55 | static class EnumUtils
56 | {
57 | public static bool TryEnumParse(string enumString, out T mode)
58 | {
59 | mode = default(T);
60 | try
61 | {
62 | mode = (T)Enum.Parse(typeof(T), enumString, true);
63 | return true;
64 | }
65 | catch (Exception)
66 | {
67 | return false;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/Configuration/FilterColumnConfigElement.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.Configuration;
20 |
21 | namespace Microsoft.Synchronization.ClientServices.Configuration
22 | {
23 | ///
24 | /// Represents a FilterColumn config element
25 | ///
26 | public class FilterColumnConfigElement : ConfigurationElement, ICloneable
27 | {
28 | ///
29 | /// Gets or sets the Name of the filter column
30 | ///
31 | [ConfigurationProperty("Name", IsRequired = true, IsKey = true)]
32 | [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\")]
33 | public string Name
34 | {
35 | get
36 | {
37 | return (string)this["Name"];
38 | }
39 | set
40 | {
41 | if (value == null)
42 | {
43 | throw new ArgumentNullException("value");
44 | }
45 | this["Name"] = value;
46 | }
47 | }
48 |
49 | #region ICloneable Members
50 |
51 | ///
52 | /// Returns a clone of the existing Config section
53 | ///
54 | /// Cloned object
55 | public object Clone()
56 | {
57 | return new FilterColumnConfigElement()
58 | {
59 | Name = this.Name,
60 | };
61 | }
62 |
63 | #endregion
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Reflection;
16 | using System.Runtime.CompilerServices;
17 | using System.Runtime.InteropServices;
18 |
19 | // General Information about an assembly is controlled through the following
20 | // set of attributes. Change these attribute values to modify the information
21 | // associated with an assembly.
22 | [assembly: AssemblyTitle("SyncSvcUtil")]
23 | [assembly: AssemblyDescription("")]
24 | [assembly: AssemblyConfiguration("")]
25 | [assembly: AssemblyCompany("Microsoft IT")]
26 | [assembly: AssemblyProduct("SyncSvcUtil")]
27 | [assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")]
28 | [assembly: AssemblyTrademark("")]
29 | [assembly: AssemblyCulture("")]
30 |
31 | // Setting ComVisible to false makes the types in this assembly not visible
32 | // to COM components. If you need to access a type in this assembly from
33 | // COM, set the ComVisible attribute to true on that type.
34 | [assembly: ComVisible(false)]
35 |
36 | // The following GUID is for the ID of the typelib if this project is exposed to COM
37 | [assembly: Guid("bf0753b4-f87b-407c-8b57-d5aebca85470")]
38 |
39 | // Version information for an assembly consists of the following four values:
40 | //
41 | // Major Version
42 | // Minor Version
43 | // Build Number
44 | // Revision
45 | //
46 | // You can specify all the values or you can default the Build and Revision Numbers
47 | // by using the '*' as shown below:
48 | // [assembly: AssemblyVersion("1.0.*")]
49 | [assembly: AssemblyVersion("1.0.0.0")]
50 | [assembly: AssemblyFileVersion("1.0.0.0")]
51 |
--------------------------------------------------------------------------------
/src/Formatters/EntryInfoWrapper.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using System.Xml.Linq;
17 | using System;
18 |
19 | namespace Microsoft.Synchronization.Services.Formatters
20 | {
21 | ///
22 | /// Internal helper class that reads and parses all relevant information about an entry element.
23 | ///
24 | internal abstract class EntryInfoWrapper
25 | {
26 | public string TypeName;
27 | public Dictionary PropertyBag = new Dictionary();
28 | public bool IsTombstone;
29 | public string ConflictDesc;
30 | public EntryInfoWrapper ConflictWrapper;
31 | public bool IsConflict;
32 | public string ETag;
33 | public string TempId;
34 | public Uri EditUri;
35 | public string Id;
36 |
37 | protected abstract void LoadConflictEntry(XElement entry);
38 | protected abstract void LoadEntryProperties(XElement entry);
39 | protected abstract void LoadTypeName(XElement entry);
40 |
41 | ///
42 | /// Constructor
43 | ///
44 | ///
45 | protected EntryInfoWrapper(XElement reader)
46 | {
47 | if (reader == null)
48 | {
49 | throw new ArgumentNullException("reader");
50 | }
51 |
52 | PropertyBag = new Dictionary();
53 |
54 | LoadTypeName(reader);
55 | LoadEntryProperties(reader);
56 | LoadConflictEntry(reader);
57 | }
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Reflection;
16 | using System.Runtime.CompilerServices;
17 | using System.Runtime.InteropServices;
18 |
19 | // General Information about an assembly is controlled through the following
20 | // set of attributes. Change these attribute values to modify the information
21 | // associated with an assembly.
22 | [assembly: AssemblyTitle("SyncSvcUtilUI")]
23 | [assembly: AssemblyDescription("")]
24 | [assembly: AssemblyConfiguration("")]
25 | [assembly: AssemblyCompany("Microsoft IT")]
26 | [assembly: AssemblyProduct("SyncSvcUtilUI")]
27 | [assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")]
28 | [assembly: AssemblyTrademark("")]
29 | [assembly: AssemblyCulture("")]
30 |
31 | // Setting ComVisible to false makes the types in this assembly not visible
32 | // to COM components. If you need to access a type in this assembly from
33 | // COM, set the ComVisible attribute to true on that type.
34 | [assembly: ComVisible(false)]
35 |
36 | // The following GUID is for the ID of the typelib if this project is exposed to COM
37 | [assembly: Guid("2d982ae5-40e4-46f4-aa94-5448ef46acfe")]
38 |
39 | // Version information for an assembly consists of the following four values:
40 | //
41 | // Major Version
42 | // Minor Version
43 | // Build Number
44 | // Revision
45 | //
46 | // You can specify all the values or you can default the Build and Revision Numbers
47 | // by using the '*' as shown below:
48 | // [assembly: AssemblyVersion("1.0.*")]
49 | [assembly: AssemblyVersion("1.0.0.0")]
50 | [assembly: AssemblyFileVersion("1.0.0.0")]
51 |
--------------------------------------------------------------------------------
/src/Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Reflection;
16 | using System.Runtime.CompilerServices;
17 | using System.Runtime.InteropServices;
18 |
19 | // General Information about an assembly is controlled through the following
20 | // set of attributes. Change these attribute values to modify the information
21 | // associated with an assembly.
22 | [assembly: AssemblyTitle("Microsoft.Synchronization.ClientServices")]
23 | [assembly: AssemblyDescription("")]
24 | [assembly: AssemblyConfiguration("")]
25 | //[assembly: AssemblyCompany("Microsoft")]
26 | [assembly: AssemblyProduct("Microsoft Synchronization Framework")]
27 | //[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
28 | //[assembly: AssemblyTrademark("")]
29 | [assembly: AssemblyCulture("")]
30 |
31 | // Setting ComVisible to false makes the types in this assembly not visible
32 | // to COM components. If you need to access a type in this assembly from
33 | // COM, set the ComVisible attribute to true on that type.
34 | [assembly: ComVisible(false)]
35 |
36 | // The following GUID is for the ID of the typelib if this project is exposed to COM
37 | [assembly: Guid("a111eb1e-dad4-457c-8037-7b8bc8dfffde")]
38 |
39 | // Version information for an assembly consists of the following four values:
40 | //
41 | // Major Version
42 | // Minor Version
43 | // Build Number
44 | // Revision
45 | //
46 | // You can specify all the values or you can default the Revision and Build Numbers
47 | // by using the '*' as shown below:
48 | //[assembly: AssemblyVersion("1.0.0.0")]
49 | //[assembly: AssemblyFileVersion("1.0.0.0")]
50 | [assembly: InternalsVisibleTo("CacheControllerTest.Web")]
51 |
--------------------------------------------------------------------------------
/src/ClientCommon/OfflineSyncProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// OfflineSyncProvider
24 | ///
25 | public abstract class OfflineSyncProvider
26 | {
27 | ///
28 | /// Begin Session
29 | ///
30 | public abstract void BeginSession();
31 |
32 | ///
33 | /// GetChangeSet, called on the Source to get the changes
34 | ///
35 | ///
36 | ///
37 | public abstract ChangeSet GetChangeSet(Guid state);
38 |
39 | ///
40 | /// OnChangeSetUploaded, fired when changeset is uploaded
41 | ///
42 | ///
43 | ///
44 | public abstract void OnChangeSetUploaded(Guid state, ChangeSetResponse response);
45 |
46 | ///
47 | /// Gets the server blob
48 | ///
49 | ///
50 | public abstract byte[] GetServerBlob();
51 |
52 | ///
53 | /// SaveChangeSet, called on the destination to save the changes on the local storage
54 | ///
55 | ///
56 | public abstract void SaveChangeSet(ChangeSet changeSet);
57 |
58 | ///
59 | /// End Session
60 | ///
61 | public abstract void EndSession();
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/ClientCommon/RefreshCompletedEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Eventargs that is returned on completing of the RefreshAsync call.
24 | ///
25 | public class RefreshCompletedEventArgs : EventArgs
26 | {
27 | ///
28 | /// Denotes any exception that happened during Refresh.
29 | ///
30 | public Exception Error { get; private set; }
31 |
32 | ///
33 | /// Statistics for the Refresh call.
34 | ///
35 | public CacheRefreshStatistics Statistics { get; private set; }
36 |
37 | ///
38 | /// Bool that indicates whether the Refresh operation was cancelled or not.
39 | ///
40 | public bool Cancelled { get; private set; }
41 |
42 | ///
43 | /// Internal ctor to prevent public instantiation.
44 | ///
45 | /// Statistics parameter
46 | /// Refresh exception.
47 | /// Cancellation flag
48 | internal RefreshCompletedEventArgs(CacheRefreshStatistics stats, Exception error, bool cancelled)
49 | {
50 | if (stats == null)
51 | {
52 | throw new ArgumentNullException("stats");
53 | }
54 |
55 | this.Statistics = stats;
56 | this.Error = error;
57 | this.Cancelled = cancelled;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/ClientCommon/ChangeSet.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Denotes a list of changes that is either to be uploaded or downloaded.
24 | ///
25 | public class ChangeSet
26 | {
27 | ///
28 | /// The Server blob (locally stored for an upload and server version for an Download)
29 | ///
30 | public byte[] ServerBlob { get; set; }
31 |
32 | ///
33 | /// An collection of IOfflineEntity objects which depicts the actual data being uploaded or downloaded.
34 | ///
35 | public ICollection Data { get; set; }
36 |
37 | ///
38 | /// Flag depicting whether or not this is a last batch or not.
39 | ///
40 | public bool IsLastBatch { get; set; }
41 |
42 | ///
43 | /// Public constructor for ChangeSet object. Instantiates with an empty collection for Data and default values of null for
44 | /// serverBlob and true for IsLastBatch
45 | ///
46 | public ChangeSet()
47 | {
48 | this.ServerBlob = null;
49 | this.Data = new List();
50 | this.IsLastBatch = true;
51 | }
52 | internal void AddItem(IOfflineEntity iOfflineEntity)
53 | {
54 | if (Data == null)
55 | {
56 | Data = new List();
57 | }
58 | Data.Add(iOfflineEntity);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/ClientCommon/ProcessCacheRequestCompletedEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Event args for the CacheRequestHandler.ProcessCacheRequestAsync call.
24 | ///
25 | class ProcessCacheRequestCompletedEventArgs : EventArgs
26 | {
27 | public Guid Id;
28 | public ChangeSet ChangeSet;
29 | public ChangeSetResponse ChangeSetResponse;
30 | public Exception Error;
31 | public object State;
32 | public uint BatchUploadCount;
33 |
34 | public ProcessCacheRequestCompletedEventArgs(Guid id, ChangeSetResponse response, int uploadCount, Exception error, object state)
35 | {
36 | this.ChangeSetResponse = response;
37 | this.Error = error;
38 | this.State = state;
39 | this.Id = id;
40 | this.BatchUploadCount = (uint)uploadCount;
41 |
42 | // Check that error is carried over to the response
43 | if (this.Error != null)
44 | {
45 | if (this.ChangeSetResponse == null)
46 | {
47 | this.ChangeSetResponse = new ChangeSetResponse();
48 | }
49 | this.ChangeSetResponse.Error = this.Error;
50 | }
51 | }
52 |
53 | public ProcessCacheRequestCompletedEventArgs(Guid id, ChangeSet changeSet, Exception error, object state)
54 | {
55 | this.ChangeSet = changeSet;
56 | this.Error = error;
57 | this.State = state;
58 | this.Id = id;
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/ClientCommon/CacheRefreshStatistics.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Microsoft.Synchronization.ClientServices
21 | {
22 | ///
23 | /// Class that represents the stats for a sync session.
24 | ///
25 | public class CacheRefreshStatistics
26 | {
27 | ///
28 | /// Start Time of Sync Session
29 | ///
30 | public DateTime StartTime { get; internal set; }
31 |
32 | ///
33 | /// End Time of Sync Session
34 | ///
35 | public DateTime EndTime { get; internal set; }
36 |
37 | ///
38 | /// Total number of change sets downloaded
39 | ///
40 | public uint TotalChangeSetsDownloaded { get; internal set; }
41 |
42 | ///
43 | /// Total number of change sets uploaded
44 | ///
45 | public uint TotalChangeSetsUploaded { get; internal set; }
46 |
47 | ///
48 | /// Total number of Uploded Items
49 | ///
50 | public uint TotalUploads { get; internal set; }
51 |
52 | ///
53 | /// Total number of downloaded items
54 | ///
55 | public uint TotalDownloads { get; internal set; }
56 |
57 | ///
58 | /// Total number of Sync Conflicts
59 | ///
60 | public uint TotalSyncConflicts { get; internal set; }
61 |
62 | ///
63 | /// Total number of Sync Conflicts
64 | ///
65 | public uint TotalSyncErrors { get; internal set; }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/SyncProvisionWizardPages/Step2_SummaryOfProvDeProvPage.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.ComponentModel;
18 | using System.Drawing;
19 | using System.Data;
20 | using System.Linq;
21 | using System.Text;
22 | using System.Windows.Forms;
23 | using System.IO;
24 | using System.Configuration;
25 | using Microsoft.Synchronization.ClientServices.Configuration;
26 | using System.Diagnostics;
27 |
28 | namespace SyncSvcUtilUI.SyncProvisionWizardPages
29 | {
30 | public partial class Step2_SummaryOfProvDeProvPage : UserControl, IWizardPage
31 | {
32 | public Step2_SummaryOfProvDeProvPage()
33 | {
34 | InitializeComponent();
35 | }
36 |
37 | #region IWizardPage Members
38 |
39 | public void OnFocus()
40 | {
41 |
42 | // Display the contents of the current SyncScope for review
43 | this.displayBox.Text = "Running SyncSvcUtil command...\n";
44 | this.displayBox.Text += WizardHelper.ExecuteProcessAndReturnLog(
45 | string.Format(WizardHelper.PROV_PARAM_FORMAT,
46 | WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.CONFIG_FILE_NAME],
47 | WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_PROV_MODE],
48 | WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_CONFIG_NAME],
49 | WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_DB_NAME]));
50 | }
51 |
52 | public bool OnMovingNext()
53 | {
54 | return false;
55 | // no-op
56 | }
57 |
58 | public void OnFinish()
59 | {
60 | // no-op
61 | }
62 |
63 | #endregion
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/SyncActiveException.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
18 | {
19 | ///
20 | /// Exception thrown when SaveChanges is attempted while sync is active.
21 | ///
22 | public class SyncActiveException : Exception
23 | {
24 | ///
25 | /// Initializes a new instance of the Microsoft.Synchronization.ClientServices.IsolatedStorage.SyncActiveException
26 | /// class.
27 | ///
28 | public SyncActiveException()
29 | : this(null)
30 | {
31 | }
32 |
33 | ///
34 | /// Initializes a new instance of the Microsoft.Synchronization.ClientServices.IsolatedStorage.SyncActiveException
35 | /// class with a specified error message.
36 | ///
37 | /// The message that describes the error.
38 | public SyncActiveException(string message)
39 | : this(message, null)
40 | {
41 | }
42 |
43 | ///
44 | /// Initializes a new instance of the Microsoft.Synchronization.ClientServices.IsolatedStorage.SyncActiveException
45 | /// class with a specified error message and a reference to the inner exception that is the cause of this exception.
46 | ///
47 | /// The error message that explains the reason for the exception.
48 | /// The exception that is the cause of the current exception, or a null reference
49 | /// (Nothing in Visual Basic) if no inner exception is specified.
50 | public SyncActiveException(string message, Exception innerException)
51 | : base(message, innerException)
52 | {
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/SyncConfigWizardPages/Step5_SummaryAndFinishPage.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.ComponentModel;
18 | using System.Drawing;
19 | using System.Data;
20 | using System.Linq;
21 | using System.Text;
22 | using System.Windows.Forms;
23 | using System.IO;
24 | using System.Configuration;
25 | using Microsoft.Synchronization.ClientServices.Configuration;
26 |
27 | namespace SyncSvcUtilUI.SyncConfigWizardPages
28 | {
29 | public partial class Step5_SummaryAndFinishPage : UserControl, IWizardPage
30 | {
31 | public Step5_SummaryAndFinishPage()
32 | {
33 | InitializeComponent();
34 | }
35 |
36 | #region IWizardPage Members
37 |
38 | public void OnFocus()
39 | {
40 | // Display the contents of the current SyncScope for review
41 | this.displayBox.Text = WizardHelper.Instance.SyncConfigSection.ToString();
42 | }
43 |
44 | public bool OnMovingNext()
45 | {
46 | return false;
47 | // no-op
48 | }
49 |
50 | public void OnFinish()
51 | {
52 | Configuration config = ConfigurationManager.OpenMappedExeConfiguration
53 | (new ExeConfigurationFileMap()
54 | {
55 | ExeConfigFilename = WizardHelper.Instance.ConfigFileWizardHelper[WizardHelper.CONFIG_FILE_NAME]
56 | }, ConfigurationUserLevel.None);
57 | config.Sections.Clear();
58 | if (File.Exists(WizardHelper.Instance.ConfigFileWizardHelper[WizardHelper.CONFIG_FILE_NAME]))
59 | {
60 | config.Sections.Remove("SyncConfiguration");
61 | }
62 | config.Sections.Add("SyncConfiguration", WizardHelper.Instance.SyncConfigSection);
63 | config.Save(ConfigurationSaveMode.Full);
64 | }
65 |
66 | #endregion
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/OfflineEntitySnapshot.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 |
18 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
19 | {
20 | ///
21 | /// Class which stores the snapshot of an entity.
22 | ///
23 | internal class OfflineEntitySnapshot
24 | {
25 | public OfflineEntitySnapshot()
26 | {
27 | this._properties = new Dictionary();
28 | }
29 |
30 | ///
31 | /// Tick count of the snapshot
32 | ///
33 | public ulong TickCount
34 | {
35 | get; set;
36 | }
37 |
38 | ///
39 | /// State of the entity for which this is a snapshot
40 | ///
41 | public OfflineEntityState EntityState
42 | {
43 | get; set;
44 | }
45 |
46 | ///
47 | /// Whether or not the snapshotted entity is a tombstone.
48 | ///
49 | public bool IsTombstone
50 | {
51 | get; set;
52 | }
53 |
54 | ///
55 | /// Mapping of property names to values representing the properties of the entity.
56 | ///
57 | public IDictionary Properties
58 | {
59 | get
60 | {
61 | return _properties;
62 | }
63 | }
64 |
65 | ///
66 | /// Copy of the metadata the entity had before a snapshot was created. This is important
67 | /// in the case of rolling back tombstones.
68 | ///
69 | public OfflineEntityMetadata Metadata
70 | {
71 | get;
72 | set;
73 | }
74 |
75 | ///
76 | /// Mapping of property names to values generated when a snapshot is created.
77 | ///
78 | Dictionary _properties;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/IsolatedStorageSchema.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Collections.ObjectModel;
18 | using System.Reflection;
19 |
20 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
21 | {
22 | ///
23 | /// This class is used to specify the schema used by the IsolatedStorageOfflineContext
24 | ///
25 | public class IsolatedStorageSchema
26 | {
27 | ///
28 | /// Default constructor
29 | ///
30 | public IsolatedStorageSchema()
31 | {
32 | _collections = new Dictionary();
33 | }
34 |
35 | ///
36 | /// Adds a new collection for the type T.
37 | ///
38 | /// Type of entity for the new collection
39 | public void AddCollection() where T : IsolatedStorageOfflineEntity
40 | {
41 | Type t = typeof(T);
42 |
43 | if (IsolatedStorageOfflineEntity.GetEntityKeyProperties(t).Length == 0)
44 | {
45 | throw new ArgumentException("Type: " + t.FullName + " does not have a key specified");
46 | }
47 |
48 | _collections.Add(t.FullName, t);
49 | }
50 |
51 | //
52 | // POST LABS METHOD - Maintained for reference
53 | //public void AddCollection(string collectionName,
54 | // IEnumerable subTypes) where T : IsolatedStorageOfflineEntity;
55 |
56 | ///
57 | /// Returns the list of types used for collections.
58 | ///
59 | public ReadOnlyCollection Collections
60 | {
61 | get
62 | {
63 | return new ReadOnlyCollection(new List(_collections.Values));
64 | }
65 |
66 | }
67 |
68 | //
69 | // POST LABS METHOD
70 | //public IEnumerable GetTypes(Type t);
71 |
72 | Dictionary _collections;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/Configuration/ConfigurationCollectionValidatorAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.Configuration;
20 |
21 | namespace Microsoft.Synchronization.ClientServices.Configuration
22 | {
23 | ///
24 | /// Validate that the number of elements in the collection are within the range.
25 | ///
26 | ///
27 | [AttributeUsage(AttributeTargets.Property)]
28 | public class ConfigurationCollectionValidatorAttribute : ConfigurationValidatorAttribute
29 | {
30 | private uint minCount = 0;
31 | private uint maxCount = uint.MaxValue;
32 |
33 | ///
34 | /// Minimum occurrences that are allowed witin a collection.
35 | ///
36 | ///
37 | public uint MinOccurences
38 | {
39 | get
40 | {
41 | return minCount;
42 | }
43 | set
44 | {
45 | if (value > maxCount)
46 | {
47 | throw new ArgumentOutOfRangeException("value", "value cannot be greater than MaxOccurences");
48 | }
49 | this.minCount = value;
50 | }
51 | }
52 |
53 | ///
54 | /// Maximum occurrences that are allowed witin a collection.
55 | ///
56 | ///
57 | public uint MaxOccurences
58 | {
59 | get
60 | {
61 | return maxCount;
62 | }
63 | set
64 | {
65 | if (value < minCount)
66 | {
67 | throw new ArgumentOutOfRangeException("value", "value cannot be less than MinOccurences");
68 | }
69 | this.maxCount = value;
70 | }
71 | }
72 |
73 | ///
74 | /// Validation class to use.
75 | ///
76 | ///
77 | public override ConfigurationValidatorBase ValidatorInstance
78 | {
79 | get
80 | {
81 | return new ConfigurationCollectionValidator(minCount, maxCount);
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/ClientCommon/ChangeSetResponse.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.Collections.ObjectModel;
20 |
21 | namespace Microsoft.Synchronization.ClientServices
22 | {
23 | ///
24 | /// Denotes a response for the a ChangeSet that was uploaded.
25 | ///
26 | public class ChangeSetResponse
27 | {
28 | List _conflicts;
29 | List _updatedItems;
30 |
31 | ///
32 | /// Server knowledge from the server after applying the changes remotely.
33 | ///
34 | public byte[] ServerBlob { get; set; }
35 |
36 | ///
37 | /// Any fatal/protocol related error encountered while applying the upload
38 | ///
39 | public Exception Error { get; set; }
40 |
41 | ///
42 | /// An collection of conflict objects
43 | ///
44 | public ReadOnlyCollection Conflicts
45 | {
46 | get
47 | {
48 | return new ReadOnlyCollection(_conflicts);
49 | }
50 | }
51 |
52 | ///
53 | /// A read only collection of Insert entities uploaded by clients that have been issued
54 | /// permanent Id's by the service
55 | ///
56 | public ReadOnlyCollection UpdatedItems
57 | {
58 | get
59 | {
60 | return new ReadOnlyCollection(_updatedItems);
61 | }
62 | }
63 |
64 | internal ChangeSetResponse()
65 | {
66 | _conflicts = new List();
67 | _updatedItems = new List();
68 | }
69 |
70 | internal void AddConflict(Conflict conflict)
71 | {
72 | this._conflicts.Add(conflict);
73 | }
74 |
75 | internal void AddUpdatedItem(IOfflineEntity item)
76 | {
77 | this._updatedItems.Add(item);
78 | }
79 |
80 | internal List ConflictsInternal
81 | {
82 | get
83 | {
84 | return this._conflicts;
85 | }
86 | }
87 |
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/ms_lpl_license_files.txt:
--------------------------------------------------------------------------------
1 | SyncServiceLib\Batching\Batch.cs
2 | SyncServiceLib\Batching\BatchHeader.cs
3 | SyncServiceLib\Batching\FileBasedBatchHandler.cs
4 | SyncServiceLib\Batching\IBatchHandler.cs
5 | SyncServiceLib\Configuration\ISyncServiceConfiguration.cs
6 | SyncServiceLib\Configuration\MetadataCache.cs
7 | SyncServiceLib\Configuration\MetadataCacheItem.cs
8 | SyncServiceLib\Configuration\MetadataCacheKey.cs
9 | SyncServiceLib\Configuration\SyncServiceConfiguration.cs
10 | SyncServiceLib\Diag\DiagHelper.cs
11 | SyncServiceLib\diagxslt.Designer.cs
12 | SyncServiceLib\Enums.cs
13 | SyncServiceLib\Error\Error.cs
14 | SyncServiceLib\Error\ErrorHandler.cs
15 | SyncServiceLib\Error\HttpStatusCode.cs
16 | SyncServiceLib\Error\Strings.cs
17 | SyncServiceLib\Error\SyncServiceException.cs
18 | SyncServiceLib\HttpContextServiceHost.cs
19 | SyncServiceLib\IRequestHandler.cs
20 | SyncServiceLib\Properties\AssemblyInfo.cs
21 | SyncServiceLib\Request.cs
22 | SyncServiceLib\RequestParser.cs
23 | SyncServiceLib\RequestProcessor\DelegateBodyWriter.cs
24 | SyncServiceLib\RequestProcessor\DownloadChangesRequestProcessor.cs
25 | SyncServiceLib\RequestProcessor\IRequestProcessor.cs
26 | SyncServiceLib\RequestProcessor\RequestProcessorFactory.cs
27 | SyncServiceLib\RequestProcessor\ScopeSchemaRequestProcessor.cs
28 | SyncServiceLib\RequestProcessor\SyncRequestProcessorBase.cs
29 | SyncServiceLib\RequestProcessor\SyncScopesRequestProcessor.cs
30 | SyncServiceLib\RequestProcessor\UploadChangesRequestProcessor.cs
31 | SyncServiceLib\ServiceError.cs
32 | SyncServiceLib\SqlProvider\ApplyChangesResponse.cs
33 | SyncServiceLib\SqlProvider\DataSetToEntitiesConverter.cs
34 | SyncServiceLib\SqlProvider\GetChangesResponse.cs
35 | SyncServiceLib\SqlProvider\IAsymmetricProviderService.cs
36 | SyncServiceLib\SqlProvider\provider\BatchRangeSetUtil.cs
37 | SyncServiceLib\SqlProvider\provider\RowSorter.cs
38 | SyncServiceLib\SqlProvider\provider\SqlEditionHelper.cs
39 | SyncServiceLib\SqlProvider\provider\SyncUtil.cs
40 | SyncServiceLib\SqlProvider\SqlSyncProviderFilterParameterInfo.cs
41 | SyncServiceLib\SqlProvider\SqlSyncProviderService.cs
42 | SyncServiceLib\SyncBlob.cs
43 | SyncServiceLib\SyncConflictContext.cs
44 | SyncServiceLib\SyncConflictInterceptorAttribute.cs
45 | SyncServiceLib\SyncDownloadResponseOperationContext.cs
46 | SyncServiceLib\SyncEntityPropertyIsNullableAttribute.cs
47 | SyncServiceLib\SyncEntityPropertyMappingAttribute.cs
48 | SyncServiceLib\SyncEntityTypeAttribute.cs
49 | SyncServiceLib\SyncInterceptorAttribute.cs
50 | SyncServiceLib\SyncInterceptorsInfoWrapper.cs
51 | SyncServiceLib\SyncOperationContext.cs
52 | SyncServiceLib\SyncRequestInterceptorAttribute.cs
53 | SyncServiceLib\SyncResponseInterceptorAttribute.cs
54 | SyncServiceLib\SyncService.cs
55 | SyncServiceLib\SyncServiceHost.cs
56 | SyncServiceLib\SyncServiceHostFactory.cs
57 | SyncServiceLib\SyncServiceTracer.cs
58 | SyncServiceLib\SyncUploadRequestOperationContext.cs
59 | SyncServiceLib\SyncUploadResponseOperationContext.cs
60 | SyncServiceLib\Utility\ODataIdParser.cs
61 | SyncServiceLib\Utility\SyncServiceConstants.cs
62 | SyncServiceLib\Utility\WebUtil.cs
63 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/StoreConflict.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 |
17 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
18 | {
19 | ///
20 | /// Conflict that happens when SaveChanges is attempted but a modified item has been
21 | /// changed during sync. CurrentEntity is the entity which is represented by the store.
22 | /// Modified entity is the currently modified one.
23 | ///
24 | public class StoreConflict : Conflict
25 | {
26 | ///
27 | /// Constructor which intializes the StoreConflict with the specified context.
28 | ///
29 | ///
30 | internal StoreConflict(IsolatedStorageOfflineContext context)
31 | {
32 | this._context = context;
33 | }
34 |
35 | ///
36 | /// Returns the entity that the user has modified and which cannot currently be saved.
37 | ///
38 | public IsolatedStorageOfflineEntity ModifiedEntity
39 | {
40 | get;
41 | internal set;
42 | }
43 |
44 | ///
45 | /// Calls the context to resolve it.
46 | ///
47 | ///
48 | public void Resolve(StoreConflictResolutionAction resolutionAction)
49 | {
50 | if (_context == null)
51 | {
52 | throw new InvalidOperationException("Conflict has already been resolved");
53 | }
54 |
55 | _context.ResolveStoreConflict(this, resolutionAction);
56 | }
57 |
58 | ///
59 | /// Called internally to avoid a deadlock when CancelChanges is called on the
60 | /// context
61 | ///
62 | ///
63 | internal void ResolveInternal(StoreConflictResolutionAction resolutionAction)
64 | {
65 | _context.ResolveStoreConflictNoLock(this, resolutionAction);
66 | }
67 |
68 | ///
69 | /// Clears out the context so that conflicts cannot be resolved multiple times.
70 | ///
71 | internal void ClearContext()
72 | {
73 | _context = null;
74 | }
75 |
76 | private IsolatedStorageOfflineContext _context;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/Configuration/ConfigurationCollectionValidator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.Configuration;
20 |
21 | namespace Microsoft.Synchronization.ClientServices.Configuration
22 | {
23 | ///
24 | /// Helps validate a collection against a specified min and max count.
25 | ///
26 | public class ConfigurationCollectionValidator : ConfigurationValidatorBase
27 | {
28 | private uint minCount;
29 | private uint maxCount;
30 |
31 | ///
32 | /// Constructor.
33 | ///
34 | /// Mininmum number of elements the collection can have.
35 | /// Maximum number of elements the collection can have.
36 | ///
37 | public ConfigurationCollectionValidator(uint minCount, uint maxCount)
38 | {
39 | this.minCount = minCount;
40 | this.maxCount = maxCount;
41 | }
42 |
43 | ///
44 | /// Validate that the number of elements in the collection are within the range.
45 | ///
46 | /// The configuration collection to validate.
47 | ///
48 | public override void Validate(object value)
49 | {
50 | ConfigurationElementCollection collection = value as ConfigurationElementCollection;
51 | if (collection != null)
52 | {
53 | if (collection.Count < minCount)
54 | {
55 | throw new ArgumentException("The collection should contain atleast " + minCount + " entries.");
56 | }
57 | if (collection.Count > maxCount)
58 | {
59 | throw new ArgumentException("The collection should not contain more than " + maxCount + " entries.");
60 | }
61 | }
62 | }
63 |
64 | ///
65 | /// Check if the passed in type can be validated.
66 | ///
67 | /// The type to check
68 | ///
69 | public override bool CanValidate(Type type)
70 | {
71 | return typeof(ConfigurationElementCollection).IsAssignableFrom(type);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/ClientCommon/IsolatedStorage/SaveFailedException.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 |
18 | namespace Microsoft.Synchronization.ClientServices.IsolatedStorage
19 | {
20 | ///
21 | /// Exception thrown when the SaveChanges call fails
22 | ///
23 | public class SaveFailedException : Exception
24 | {
25 | ///
26 | /// Initializes a new instance of the SaveFailedException class.
27 | ///
28 | /// Store conflicts which are preventing SaveChanges from succeeding
29 | internal SaveFailedException(IEnumerable conflicts)
30 | : base()
31 | {
32 | this._conflicts = conflicts;
33 | }
34 |
35 | ///
36 | /// Initializes a new instance of the SaveFailedException class.
37 | ///
38 | /// Store conflicts which are preventing SaveChanges from succeeding
39 | /// Message that describes the error.
40 | public SaveFailedException(IEnumerable conflicts, string message)
41 | : base(message)
42 | {
43 | this._conflicts = conflicts;
44 | }
45 |
46 | ///
47 | /// Initializes a new instance of the SaveFailedException class.
48 | ///
49 | /// Store conflicts which are preventing SaveChanges from succeeding
50 | /// Message that describes the error.
51 | /// The exception that is the cause of the current exception, or a null reference
52 | /// (Nothing in Visual Basic) if no inner exception is specified.
53 | public SaveFailedException(
54 | IEnumerable conflicts,
55 | string message,
56 | Exception innerException)
57 | : base(message, innerException)
58 | {
59 | this._conflicts = conflicts;
60 | }
61 |
62 | ///
63 | /// The list of StoreConflicts that occurred when SaveChanges was attempted.
64 | ///
65 | public IEnumerable Conflicts
66 | {
67 | get
68 | {
69 | return _conflicts;
70 | }
71 | }
72 |
73 | IEnumerable _conflicts;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/Client/FrameworkSupport/JsonReaderWriterFactory.cs:
--------------------------------------------------------------------------------
1 | // Type: System.Runtime.Serialization.Json.JsonReaderWriterFactory
2 | // Assembly: System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
3 | // Assembly location: C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll
4 |
5 | using System.IO;
6 | using System.ServiceModel;
7 | using System.Text;
8 | using System.Xml;
9 |
10 | namespace System.Xml
11 | {
12 | public delegate void OnXmlDictionaryReaderClose(XmlDictionaryReader reader);
13 | }
14 |
15 | namespace System.Runtime.Serialization.Json
16 | {
17 | public static class JsonReaderWriterFactory
18 | {
19 | public static XmlDictionaryReader CreateJsonReader(Stream stream, XmlDictionaryReaderQuotas quotas)
20 | {
21 | return JsonReaderWriterFactory.CreateJsonReader(stream, (Encoding)null, quotas, (OnXmlDictionaryReaderClose)null);
22 | }
23 |
24 | public static XmlDictionaryReader CreateJsonReader(byte[] buffer, XmlDictionaryReaderQuotas quotas)
25 | {
26 | if (buffer == null)
27 | throw new ArgumentNullException("buffer");
28 | else
29 | return JsonReaderWriterFactory.CreateJsonReader(buffer, 0, buffer.Length, (Encoding)null, quotas, (OnXmlDictionaryReaderClose)null);
30 | }
31 |
32 | public static XmlDictionaryReader CreateJsonReader(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
33 | {
34 | XmlJsonReader xmlJsonReader = new XmlJsonReader();
35 | xmlJsonReader.SetInput(stream, encoding, quotas, onClose);
36 | return (XmlDictionaryReader)xmlJsonReader;
37 | }
38 |
39 | public static XmlDictionaryReader CreateJsonReader(byte[] buffer, int offset, int count, XmlDictionaryReaderQuotas quotas)
40 | {
41 | return JsonReaderWriterFactory.CreateJsonReader(buffer, offset, count, (Encoding)null, quotas, (OnXmlDictionaryReaderClose)null);
42 | }
43 |
44 | public static XmlDictionaryReader CreateJsonReader(byte[] buffer, int offset, int count, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
45 | {
46 | XmlJsonReader xmlJsonReader = new XmlJsonReader();
47 | xmlJsonReader.SetInput(buffer, offset, count, encoding, quotas, onClose);
48 | return (XmlDictionaryReader)xmlJsonReader;
49 | }
50 |
51 | public static XmlDictionaryWriter CreateJsonWriter(Stream stream)
52 | {
53 | return JsonReaderWriterFactory.CreateJsonWriter(stream, Encoding.UTF8, true);
54 | }
55 |
56 | public static XmlDictionaryWriter CreateJsonWriter(Stream stream, Encoding encoding)
57 | {
58 | return JsonReaderWriterFactory.CreateJsonWriter(stream, encoding, true);
59 | }
60 |
61 | public static XmlDictionaryWriter CreateJsonWriter(Stream stream, Encoding encoding, bool ownsStream)
62 | {
63 | XmlJsonWriter xmlJsonWriter = new XmlJsonWriter();
64 | xmlJsonWriter.SetOutput(stream, encoding, ownsStream);
65 | return (XmlDictionaryWriter)xmlJsonWriter;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/iOSClient/FrameworkSupport/LocalizableString.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using System.Reflection;
3 |
4 | namespace System.ComponentModel.DataAnnotations
5 | {
6 | internal class LocalizableString
7 | {
8 | private string _propertyName;
9 | private string _propertyValue;
10 | private Type _resourceType;
11 | private Func _cachedResult;
12 |
13 | public string Value
14 | {
15 | get
16 | {
17 | return this._propertyValue;
18 | }
19 | set
20 | {
21 | if (!(this._propertyValue != value))
22 | return;
23 | this.ClearCache();
24 | this._propertyValue = value;
25 | }
26 | }
27 |
28 | public Type ResourceType
29 | {
30 | get
31 | {
32 | return this._resourceType;
33 | }
34 | set
35 | {
36 | if (!(this._resourceType != value))
37 | return;
38 | this.ClearCache();
39 | this._resourceType = value;
40 | }
41 | }
42 |
43 | public LocalizableString(string propertyName)
44 | {
45 | this._propertyName = propertyName;
46 | }
47 |
48 | public string GetLocalizableValue()
49 | {
50 | if (this._cachedResult == null)
51 | {
52 | if (this._propertyValue == null || this._resourceType == (Type)null)
53 | {
54 | this._cachedResult = (Func)(() => this._propertyValue);
55 | }
56 | else
57 | {
58 | PropertyInfo property = this._resourceType.GetProperty(this._propertyValue);
59 | bool flag = false;
60 | if (!this._resourceType.IsVisible || property == (PropertyInfo)null || property.PropertyType != typeof(string))
61 | {
62 | flag = true;
63 | }
64 | else
65 | {
66 | MethodInfo getMethod = property.GetGetMethod();
67 | if (getMethod == (MethodInfo)null || !getMethod.IsPublic || !getMethod.IsStatic)
68 | flag = true;
69 | }
70 | if (flag)
71 | {
72 | string exceptionMessage = string.Format((IFormatProvider)CultureInfo.CurrentCulture,
73 | "Failed to localized value '{2}' for property '{0}' not found on type '{1}'", (object)this._propertyName,
74 | (object)this._resourceType.FullName, (object)this._propertyValue);
75 |
76 | this._cachedResult = (Func)(() =>
77 | {
78 | throw new InvalidOperationException(exceptionMessage);
79 | });
80 | }
81 | else
82 | this._cachedResult = (Func)(() => (string)property.GetValue((object)null, (object[])null));
83 | }
84 | }
85 | return this._cachedResult();
86 | }
87 |
88 | private void ClearCache()
89 | {
90 | this._cachedResult = (Func)null;
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/AndroidClient/FrameworkSupport/LocalizableString.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using System.Reflection;
3 |
4 | namespace System.ComponentModel.DataAnnotations
5 | {
6 | internal class LocalizableString
7 | {
8 | private string _propertyName;
9 | private string _propertyValue;
10 | private Type _resourceType;
11 | private Func _cachedResult;
12 |
13 | public string Value
14 | {
15 | get
16 | {
17 | return this._propertyValue;
18 | }
19 | set
20 | {
21 | if (!(this._propertyValue != value))
22 | return;
23 | this.ClearCache();
24 | this._propertyValue = value;
25 | }
26 | }
27 |
28 | public Type ResourceType
29 | {
30 | get
31 | {
32 | return this._resourceType;
33 | }
34 | set
35 | {
36 | if (!(this._resourceType != value))
37 | return;
38 | this.ClearCache();
39 | this._resourceType = value;
40 | }
41 | }
42 |
43 | public LocalizableString(string propertyName)
44 | {
45 | this._propertyName = propertyName;
46 | }
47 |
48 | public string GetLocalizableValue()
49 | {
50 | if (this._cachedResult == null)
51 | {
52 | if (this._propertyValue == null || this._resourceType == (Type)null)
53 | {
54 | this._cachedResult = (Func)(() => this._propertyValue);
55 | }
56 | else
57 | {
58 | PropertyInfo property = this._resourceType.GetProperty(this._propertyValue);
59 | bool flag = false;
60 | if (!this._resourceType.IsVisible || property == (PropertyInfo)null || property.PropertyType != typeof(string))
61 | {
62 | flag = true;
63 | }
64 | else
65 | {
66 | MethodInfo getMethod = property.GetGetMethod();
67 | if (getMethod == (MethodInfo)null || !getMethod.IsPublic || !getMethod.IsStatic)
68 | flag = true;
69 | }
70 | if (flag)
71 | {
72 | string exceptionMessage = string.Format((IFormatProvider)CultureInfo.CurrentCulture,
73 | "Failed to localized value '{2}' for property '{0}' not found on type '{1}'", (object)this._propertyName,
74 | (object)this._resourceType.FullName, (object)this._propertyValue);
75 |
76 | this._cachedResult = (Func)(() =>
77 | {
78 | throw new InvalidOperationException(exceptionMessage);
79 | });
80 | }
81 | else
82 | this._cachedResult = (Func)(() => (string)property.GetValue((object)null, (object[])null));
83 | }
84 | }
85 | return this._cachedResult();
86 | }
87 |
88 | private void ClearCache()
89 | {
90 | this._cachedResult = (Func)null;
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/SyncServiceLib/Error/Error.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Microsoft Corporation. All rights reserved.
2 |
3 | // Microsoft Limited Permissive License (Ms-LPL)
4 |
5 | // This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
6 |
7 | // 1. Definitions
8 | // The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
9 | // A “contribution” is the original software, or any additions or changes to the software.
10 | // A “contributor” is any person that distributes its contribution under this license.
11 | // “Licensed patents” are a contributor’s patent claims that read directly on its contribution.
12 |
13 | // 2. Grant of Rights
14 | // (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
15 | // (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
16 |
17 | // 3. Conditions and Limitations
18 | // (A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.
19 | // (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
20 | // (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
21 | // (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
22 | // (E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
23 | // (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.
24 |
25 | using System;
26 |
27 | namespace Microsoft.Synchronization.Services
28 | {
29 | internal static class Error
30 | {
31 | internal static Exception ArgumentNull(string paramName)
32 | {
33 | return new ArgumentNullException(paramName);
34 | }
35 |
36 | internal static Exception ArgumentEmpty(string parameterName)
37 | {
38 | return new ArgumentException(string.Format("Argument {0} cannot be empty.", parameterName));
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/Configuration/SyncConfigurationSection.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.Configuration;
20 |
21 | namespace Microsoft.Synchronization.ClientServices.Configuration
22 | {
23 | ///
24 | /// Represents the SyncConfiguration section
25 | ///
26 | public class SyncConfigurationSection : ConfigurationSection, ICloneable
27 | {
28 | ///
29 | /// Gets the list of SyncScope's configured
30 | ///
31 | [ConfigurationProperty("SyncScopes", IsDefaultCollection = true, IsRequired = true)]
32 | [ConfigurationCollectionValidator(MinOccurences = 1)]
33 | public SyncScopeCollection SyncScopes
34 | {
35 | get
36 | {
37 | SyncScopeCollection collection = (SyncScopeCollection)base["SyncScopes"];
38 | return collection;
39 | }
40 | }
41 |
42 | ///
43 | /// Gets the list of TargetDatabase sections
44 | ///
45 | [ConfigurationProperty("Databases", IsDefaultCollection = false, IsRequired = true)]
46 | [ConfigurationCollectionValidator(MinOccurences = 1)]
47 | public TargetDatabaseCollection Databases
48 | {
49 | get
50 | {
51 | TargetDatabaseCollection collection = (TargetDatabaseCollection)base["Databases"];
52 | return collection;
53 | }
54 | }
55 |
56 | ///
57 | /// Returns the section serialized a XML
58 | ///
59 | /// XML representation of the string
60 | public override string ToString()
61 | {
62 | return base.SerializeSection(this, "SyncConfiguration", ConfigurationSaveMode.Full);
63 | }
64 |
65 | #region ICloneable Members
66 |
67 | ///
68 | /// Returns a clone of the existing Config section
69 | ///
70 | /// Cloned object
71 | public object Clone()
72 | {
73 | SyncConfigurationSection section = new SyncConfigurationSection();
74 |
75 | // Clonet TargetDatabases
76 | foreach (TargetDatabaseConfigElement elem in Databases)
77 | {
78 | section.Databases.Add((TargetDatabaseConfigElement)elem.Clone());
79 | }
80 |
81 | // Clone SyncConfigs
82 | foreach (SyncScopeConfigElement elem in SyncScopes)
83 | {
84 | section.SyncScopes.Add((SyncScopeConfigElement)elem.Clone());
85 | }
86 | return section;
87 | }
88 |
89 | #endregion
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/ClientCommon/CacheRequestHandler.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Net;
17 |
18 | namespace Microsoft.Synchronization.ClientServices
19 | {
20 | ///
21 | /// Base class that will handle the processing of a CacheRequest
22 | ///
23 | abstract class CacheRequestHandler
24 | {
25 | SerializationFormat _serializationFormat;
26 | Uri _baseUri;
27 | string _scopeName;
28 |
29 | protected SerializationFormat SerializationFormat
30 | {
31 | get { return _serializationFormat; }
32 | }
33 |
34 | protected string ScopeName
35 | {
36 | get { return _scopeName; }
37 | }
38 |
39 | protected Uri BaseUri
40 | {
41 | get { return _baseUri; }
42 | }
43 |
44 | protected CacheRequestHandler(Uri baseUri, SerializationFormat format, string scopeName)
45 | {
46 | this._baseUri = baseUri;
47 | this._serializationFormat = format;
48 | this._scopeName = scopeName;
49 | }
50 |
51 | ///
52 | /// Method that will contain the actual implementation of the cache request processing.
53 | ///
54 | /// CacheRequest object
55 | /// User state object
56 | public abstract void ProcessCacheRequestAsync(CacheRequest request, object state);
57 |
58 | ///
59 | /// Event handler that callers can hook to get notified when the request has been processed.
60 | ///
61 | public event EventHandler ProcessCacheRequestCompleted;
62 |
63 | protected void OnProcessCacheRequestCompleted(ProcessCacheRequestCompletedEventArgs args)
64 | {
65 | if (this.ProcessCacheRequestCompleted != null)
66 | {
67 | this.ProcessCacheRequestCompleted(this, args);
68 | }
69 | }
70 |
71 | ///
72 | /// Factory method for creating a cache handler. For labs only Http based implementation is provided.
73 | ///
74 | /// Base Uri to connect to
75 | /// The CacheControllerBehavior object
76 | /// The AsyncWorkerManager object to use when issuning custom async operations.
77 | /// A CacheRequestHandler object
78 | public static CacheRequestHandler CreateRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
79 | {
80 | // For labs its always Http
81 | return new HttpCacheRequestHandler(serviceUri, behaviors, manager);
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/SyncServiceLib/RequestProcessor/IRequestProcessor.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Microsoft Corporation. All rights reserved.
2 |
3 | // Microsoft Limited Permissive License (Ms-LPL)
4 |
5 | // This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
6 |
7 | // 1. Definitions
8 | // The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
9 | // A “contribution” is the original software, or any additions or changes to the software.
10 | // A “contributor” is any person that distributes its contribution under this license.
11 | // “Licensed patents” are a contributor’s patent claims that read directly on its contribution.
12 |
13 | // 2. Grant of Rights
14 | // (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
15 | // (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
16 |
17 | // 3. Conditions and Limitations
18 | // (A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.
19 | // (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
20 | // (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
21 | // (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
22 | // (E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
23 | // (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.
24 |
25 | using System.ServiceModel.Channels;
26 |
27 | namespace Microsoft.Synchronization.Services
28 | {
29 | internal interface IRequestProcessor
30 | {
31 | ///
32 | /// Process the incoming request and forms a formatted outgoing response.
33 | ///
34 | /// Incoming request
35 | /// Message instance containing the outgoing response
36 | Message ProcessRequest(Request incomingRequest);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Sync Framework Toolkit for Mobile Devices
2 | ====================
3 | This repository contains the sources needed to build a mobile version of the sync framework toolkit.
4 | It supports Android, iOS and Windows Phone 8 using the Xamarin.Android and the Xamarin.iOS products from Xamarin.
5 |
6 | The original version of this toolkit was built by Microsoft and can be found here: [http://code.msdn.microsoft.com/wpapps/Sync-Framework-Toolkit-4dc10f0e](http://code.msdn.microsoft.com/wpapps/Sync-Framework-Toolkit-4dc10f0e)
7 |
8 | Required sync framework tools
9 | ---------------
10 | Important before you start using these tools. Make sure you download the appropriate sync framework installables.
11 | If you're running a x64 edition of Windows on your machine, you need to use the x64 version of the sync framework providers. For x86 editions of Windows, you need to install the x86 versions.
12 |
13 | You can find the download for the sync framework providers here:[http://www.microsoft.com/en-us/download/details.aspx?id=19502](http://www.microsoft.com/en-us/download/details.aspx?id=19502)
14 |
15 | **Please note!** You can use these only as redistributables on production environments. If you're going to run the sync framework bits on your development machine, you will need the sync framework SDK. Which you can find here: [http://www.microsoft.com/en-us/download/details.aspx?id=23217](http://www.microsoft.com/en-us/download/details.aspx?id=23217)
16 |
17 | Quickstart
18 | ---------------
19 | If you have an existing database that you want to sync to a mobile device, you can do so by following these steps:
20 |
21 | #### Generate a new sync config file
22 |
23 | 1. Compile the sources and launch the syncsvcutilui.exe program
24 | 2. Select the option to create a new sync configuration file
25 | 3. Configure which database you want to sync and what schema and tables you want synchronized.
26 | 4. Save the generated config somewhere safe. (Beware, do not include spaces in the path)
27 | 5. Close the application
28 |
29 | #### Provision the database
30 |
31 | 1. Start the syncsvcutilui.exe program
32 | 2. Select the option to provision a database for sync operations
33 | 3. Select the database you generated the sync config for and provision it
34 | 4. Close the application
35 |
36 | #### Generate server-side code
37 |
38 | 1. Start the syncsvcutilui.exe program
39 | 2. Select the option to generate code
40 | 3. Select the option to generate server code
41 | 4. Select the config on which to base the code
42 | 5. Select the output location for the code generator
43 | 6. Finish and close the wizard
44 | 7. Include the generated sources in a regular ASP.NET application
45 | 8. Modify the code to match the configuration of your database connectionstring
46 |
47 | #### Generate client-side code
48 |
49 | 1. Start the syncsvcutilui.exe program
50 | 2. Select the option to generate code
51 | 3. Select the option to generate server code
52 | 4. Select the config on which to base the code
53 | 5. Select the output location for the code generator
54 | 6. Finish and close the wizard
55 | 7. Include the sources in your mobile application project (Xamarin.iOS, Xamarin.Android or Windows Phone)
56 |
57 | Important to know
58 | -----------------
59 | Make sure the webserver that hosts the sync service code is running in the appropriate process architecture. If you are using the x64 provider (i.e. running Windows x64) you should be running the worker process in IIS in x64 mode.
60 |
61 | This means that you cannot run the sync service inside the development web server or the x86 edition of IIS express.
--------------------------------------------------------------------------------
/src/SyncServiceLib/Error/ErrorHandler.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Microsoft Corporation. All rights reserved.
2 |
3 | // Microsoft Limited Permissive License (Ms-LPL)
4 |
5 | // This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
6 |
7 | // 1. Definitions
8 | // The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
9 | // A “contribution” is the original software, or any additions or changes to the software.
10 | // A “contributor” is any person that distributes its contribution under this license.
11 | // “Licensed patents” are a contributor’s patent claims that read directly on its contribution.
12 |
13 | // 2. Grant of Rights
14 | // (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
15 | // (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
16 |
17 | // 3. Conditions and Limitations
18 | // (A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.
19 | // (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
20 | // (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
21 | // (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
22 | // (E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
23 | // (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.
24 |
25 | using System.Reflection;
26 |
27 | namespace Microsoft.Synchronization.Services
28 | {
29 | internal class ErrorHandler
30 | {
31 | internal static void HandleTargetInvocationException(TargetInvocationException exception)
32 | {
33 | var innerException = exception.InnerException as SyncServiceException;
34 | if (innerException != null)
35 | {
36 | throw new SyncServiceException(innerException.StatusCode, innerException.ErrorCode, innerException.Message, exception);
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/SyncServiceLib/Error/HttpStatusCode.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Microsoft Corporation. All rights reserved.
2 |
3 | // Microsoft Limited Permissive License (Ms-LPL)
4 |
5 | // This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
6 |
7 | // 1. Definitions
8 | // The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
9 | // A “contribution” is the original software, or any additions or changes to the software.
10 | // A “contributor” is any person that distributes its contribution under this license.
11 | // “Licensed patents” are a contributor’s patent claims that read directly on its contribution.
12 |
13 | // 2. Grant of Rights
14 | // (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
15 | // (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
16 |
17 | // 3. Conditions and Limitations
18 | // (A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.
19 | // (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
20 | // (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
21 | // (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
22 | // (E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
23 | // (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.
24 |
25 | namespace Microsoft.Synchronization.Services
26 | {
27 | internal class ResponseHttpStatusCode
28 | {
29 | internal const int Forbidden = 403;
30 | internal const int MethodNotAllowed = 405;
31 | internal const int MethodNotImplemented = 501;
32 | internal const int ResourceNotFound = 404;
33 | internal const int NotAcceptable = 406;
34 | internal const int UnsupportedMediaType = 415;
35 | internal const int PreConditionFailed = 412;
36 | internal const int BadRequest = 400;
37 | internal const int InternalServerError = 500;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/Configuration/FilterParameterConfigElement.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.Configuration;
20 |
21 | namespace Microsoft.Synchronization.ClientServices.Configuration
22 | {
23 | ///
24 | /// Represents the FilterParameter element in the config file
25 | ///
26 | public class FilterParameterConfigElement : ConfigurationElement, ICloneable
27 | {
28 | ///
29 | /// Gets or sets the Name of the filter parameter. Name must be prefixed with the the @ character
30 | ///
31 | [ConfigurationProperty("Name", IsRequired = true, IsKey = true)]
32 | [StringValidator(InvalidCharacters = "~!#$%^&*()[]{}/;'\"|\\")]
33 | public string Name
34 | {
35 | get
36 | {
37 | return (string)this["Name"];
38 | }
39 | set
40 | {
41 | if (value == null)
42 | {
43 | throw new ArgumentNullException("value");
44 | }
45 | this["Name"] = value;
46 | }
47 | }
48 |
49 | ///
50 | /// Gets or sets the SqlType of the parameter
51 | ///
52 | [ConfigurationProperty("SqlType", IsRequired = true)]
53 | public string SqlType
54 | {
55 | get
56 | {
57 | return (string)this["SqlType"];
58 | }
59 | set
60 | {
61 | if (value == null)
62 | {
63 | throw new ArgumentNullException("value");
64 | }
65 | this["SqlType"] = value;
66 | }
67 | }
68 |
69 | ///
70 | /// Gets or sets the size of variable sized type
71 | ///
72 | [ConfigurationProperty("DataSize", IsRequired = false)]
73 | public int DataSize
74 | {
75 | get
76 | {
77 | return (int)this["DataSize"];
78 | }
79 | set
80 | {
81 | this["DataSize"] = value;
82 | }
83 | }
84 |
85 | #region ICloneable Members
86 |
87 | ///
88 | /// Returns a clone of the existing Config section
89 | ///
90 | /// Cloned object
91 | public object Clone()
92 | {
93 | return new FilterParameterConfigElement()
94 | {
95 | Name = this.Name,
96 | DataSize = this.DataSize,
97 | SqlType = this.SqlType
98 | };
99 | }
100 |
101 | #endregion
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/SyncServiceLib/SyncEntityPropertyIsNullableAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright © Microsoft Corporation. All rights reserved.
2 |
3 | // Microsoft Limited Permissive License (Ms-LPL)
4 |
5 | // This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
6 |
7 | // 1. Definitions
8 | // The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
9 | // A “contribution” is the original software, or any additions or changes to the software.
10 | // A “contributor” is any person that distributes its contribution under this license.
11 | // “Licensed patents” are a contributor’s patent claims that read directly on its contribution.
12 |
13 | // 2. Grant of Rights
14 | // (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
15 | // (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
16 |
17 | // 3. Conditions and Limitations
18 | // (A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.
19 | // (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
20 | // (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
21 | // (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
22 | // (E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
23 | // (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.
24 |
25 | using System;
26 |
27 | namespace Microsoft.Synchronization.Services
28 | {
29 | ///
30 | /// Attribute used to indicate whether a specific property of a sync entity class is nullable or not.
31 | /// A property marked with the SyncEntityPropertyNullable attribute is nullable in the underlying storage.
32 | /// This is useful for data types such as 'string' which is nullable by default.
33 | ///
34 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
35 | public sealed class SyncEntityPropertyIsNullableAttribute : Attribute
36 | {
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Formatters/AtomHelper.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System.Xml;
16 | using System.Xml.Linq;
17 |
18 | namespace Microsoft.Synchronization.Services.Formatters
19 | {
20 | static class AtomHelper
21 | {
22 | ///
23 | /// Check whether the XmlReader is currently at the start of an element with
24 | /// the given name in the Atom namespace
25 | ///
26 | /// XmlReader to check on
27 | /// Element name
28 | /// True if the reader if at the indicated Atom element
29 | internal static bool IsAtomElement(XmlReader reader, string name)
30 | {
31 | return reader.NodeType == XmlNodeType.Element &&
32 | reader.LocalName == name &&
33 | reader.NamespaceURI == FormatterConstants.AtomNamespaceUri;
34 | }
35 |
36 | ///
37 | /// Check whether the XmlReader is currently at the start of an tombstone element with
38 | /// the given name in the Tombstone namespace
39 | ///
40 | /// XmlReader to check on
41 | /// Element name
42 | /// True if the reader if at the indicated Atom element
43 | internal static bool IsAtomTombstone(XmlReader reader, string name)
44 | {
45 | return reader.NodeType == XmlNodeType.Element &&
46 | reader.LocalName == name &&
47 | reader.NamespaceURI == FormatterConstants.AtomDeletedEntryNamespace;
48 | }
49 |
50 | ///
51 | /// Check whether the XmlReader is currently at the start of an element
52 | /// in the Odata namespace
53 | ///
54 | /// XmlReader to check on
55 | /// Element Namespace name
56 | /// True if the reader if at the indicated namespace
57 | internal static bool IsODataNamespace(XmlReader reader, XNamespace ns)
58 | {
59 | return reader.NodeType == XmlNodeType.Element &&
60 | reader.NamespaceURI == ns.NamespaceName;
61 | }
62 |
63 | ///
64 | /// Check whether the XmlReader is currently at the start of an element with
65 | /// the given name in the sync namespace
66 | ///
67 | /// XmlReader to check on
68 | /// Element name
69 | /// True if the reader if at the indicated anchor element
70 | internal static bool IsSyncElement(XmlReader reader, string name)
71 | {
72 | return reader.NodeType == XmlNodeType.Element &&
73 | reader.LocalName == name &&
74 | reader.NamespaceURI == FormatterConstants.SyncNamespace.NamespaceName;
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/WP7Client/FrameworkSupport/JsonReaderWriterFactory.cs:
--------------------------------------------------------------------------------
1 | //
2 | // JsonReaderWriterFactory.cs
3 | //
4 | // Author:
5 | // Atsushi Enomoto
6 | //
7 | // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining
10 | // a copy of this software and associated documentation files (the
11 | // "Software"), to deal in the Software without restriction, including
12 | // without limitation the rights to use, copy, modify, merge, publish,
13 | // distribute, sublicense, and/or sell copies of the Software, and to
14 | // permit persons to whom the Software is furnished to do so, subject to
15 | // the following conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 | using System;
29 | using System.IO;
30 | using System.Text;
31 | using System.Xml;
32 |
33 | namespace System.Xml
34 | {
35 | public delegate void OnXmlDictionaryReaderClose(XmlDictionaryReader reader);
36 | }
37 |
38 | namespace System.Runtime.Serialization.Json
39 | {
40 | public static class JsonReaderWriterFactory
41 | {
42 | public static XmlDictionaryReader CreateJsonReader(byte[] source, XmlDictionaryReaderQuotas quotas)
43 | {
44 | if (source == null)
45 | throw new ArgumentNullException("source");
46 | return CreateJsonReader(source, 0, source.Length, quotas);
47 | }
48 |
49 | public static XmlDictionaryReader CreateJsonReader(byte[] source, int offset, int length, XmlDictionaryReaderQuotas quotas)
50 | {
51 | return CreateJsonReader(source, offset, length, null, quotas, null);
52 | }
53 |
54 | public static XmlDictionaryReader CreateJsonReader(byte[] source, int offset, int length, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose readerClose)
55 | {
56 | return new JsonReader(source, offset, length, encoding, quotas, readerClose);
57 | }
58 |
59 | public static XmlDictionaryReader CreateJsonReader(Stream source, XmlDictionaryReaderQuotas quotas)
60 | {
61 | return CreateJsonReader(source, null, quotas, null);
62 | }
63 |
64 | public static XmlDictionaryReader CreateJsonReader(Stream source, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose readerClose)
65 | {
66 | return new JsonReader(source, encoding, quotas, readerClose);
67 | }
68 |
69 | public static XmlDictionaryWriter CreateJsonWriter(Stream stream)
70 | {
71 | return CreateJsonWriter(stream, new UTF8Encoding(false, true));
72 | }
73 |
74 | public static XmlDictionaryWriter CreateJsonWriter(Stream stream, Encoding encoding)
75 | {
76 | return CreateJsonWriter(stream, encoding, false);
77 | }
78 |
79 | public static XmlDictionaryWriter CreateJsonWriter(Stream stream, Encoding encoding, bool closeOutput)
80 | {
81 | return new JsonWriter(stream, encoding, closeOutput);
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtil/CodeDom/GenericClientEntityGenerator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using System.CodeDom.Compiler;
20 | using System.CodeDom;
21 | using Microsoft.Synchronization.Data;
22 |
23 | namespace Microsoft.Synchronization.ClientServices.CodeDom
24 | {
25 | ///
26 | /// Generates the file containing entities that inherit from a base class that inherits from IOfflineEntity.
27 | /// The custom base class implements the ServiceMetadata property of IOfflineEntity so we dont pollute all entities
28 | /// with the ServiceMetadata property
29 | ///
30 | class GenericClientEntityGenerator : EntityGenerator
31 | {
32 | public override void GenerateEntities(string filePrefix, string nameSpace, Data.DbSyncScopeDescription desc, Dictionary> colsMappingInfo,
33 | System.IO.DirectoryInfo dirInfo, CodeLanguage option, string serviceUri)
34 | {
35 | CodeCompileUnit entitiesCC = new CodeCompileUnit();
36 |
37 | CodeNamespace entityScopeNs = new CodeNamespace(nameSpace);
38 |
39 | // Generate the base class for all the entities which will implement IOfflineEntity
40 | CodeTypeDeclaration baseEntity = CodeDomUtility.CreateIOfflineEntityCustomBaseClass(
41 | string.IsNullOrEmpty(filePrefix) ? desc.ScopeName : filePrefix,
42 | false /*isServer*/);
43 |
44 | // Set the base type
45 | // VB uses different keywords for class and interface inheritence. For it to emit the
46 | // right keyword it must inherit from object first before the actual interface.
47 | baseEntity.BaseTypes.Add(new CodeTypeReference(typeof(object)));
48 | baseEntity.BaseTypes.Add(new CodeTypeReference(Constants.ClientIOfflineEntity));
49 |
50 | entityScopeNs.Types.Add(baseEntity);
51 |
52 | // Generate the entities
53 | foreach (DbSyncTableDescription table in desc.Tables)
54 | {
55 | Dictionary curTableMapping = null;
56 | colsMappingInfo.TryGetValue(table.UnquotedGlobalName, out curTableMapping);
57 |
58 | // Generate the actual entity
59 | CodeTypeDeclaration entityDecl = CodeDomUtility.GetEntityForTableDescription(table, true, curTableMapping);
60 |
61 | // Set the base type
62 | entityDecl.BaseTypes.Add(baseEntity.Name);
63 |
64 | //Add it to the overall scope
65 | entityScopeNs.Types.Add(entityDecl);
66 | }
67 |
68 | entitiesCC.Namespaces.Add(entityScopeNs);
69 |
70 | // Generate the files
71 | CodeDomUtility.SaveCompileUnitToFile(entitiesCC, option, CodeDomUtility.GenerateFileName(desc.ScopeName, dirInfo, filePrefix, "Entities", option));
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/tools/SyncSvcUtilUI/MainForm.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.ComponentModel;
18 | using System.Data;
19 | using System.Drawing;
20 | using System.Linq;
21 | using System.Text;
22 | using System.Windows.Forms;
23 |
24 | namespace SyncSvcUtilUI
25 | {
26 | public partial class MainForm : Form
27 | {
28 | public MainForm()
29 | {
30 | InitializeComponent();
31 | }
32 |
33 | private void exitBtn_Click(object sender, EventArgs e)
34 | {
35 | Application.Exit();
36 | }
37 |
38 | private void genOrEdirSyncCfgLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
39 | {
40 | // Launch the wizard for Sync Config generation/creator
41 | SyncMasterWizard wizard = new SyncMasterWizard();
42 |
43 | // Add pages
44 | List pages = new List();
45 | pages.Add(new SyncConfigWizardPages.Step1_CreateOrOpenPage());
46 | pages.Add(new SyncConfigWizardPages.Step2_AddDatabaseInfoPage());
47 | pages.Add(new SyncConfigWizardPages.Step3_AddSyncScopePage());
48 | pages.Add(new SyncConfigWizardPages.Step4_AddSyncTablesPage());
49 | pages.Add(new SyncConfigWizardPages.Step5_SummaryAndFinishPage());
50 |
51 | // Set wizard pages
52 | wizard.SetPages(pages.ToArray());
53 |
54 | // Show wizard
55 | wizard.ShowDialog(this);
56 | }
57 |
58 | private void provLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
59 | {
60 | // Launch the wizard for Provision/Deprovision link
61 | SyncMasterWizard wizard = new SyncMasterWizard();
62 |
63 | // Add pages
64 | List pages = new List();
65 | pages.Add(new SyncProvisionWizardPages.Setp1_GetAndOpenConfigFile());
66 | pages.Add(new SyncProvisionWizardPages.Step2_SummaryOfProvDeProvPage());
67 |
68 | // Set wizard pages
69 | wizard.SetPages(pages.ToArray());
70 |
71 | // Show wizard
72 | wizard.ShowDialog(this);
73 | }
74 |
75 | private void codeGenLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
76 | {
77 | // Launch the wizard for Provision/Deprovision link
78 | SyncMasterWizard wizard = new SyncMasterWizard();
79 |
80 | // Add pages
81 | List pages = new List();
82 | pages.Add(new CodegenWizardPages.Step1_PickConfigOrCSDLModelPage());
83 | pages.Add(new CodegenWizardPages.Step2_SelectCodeGenPrams());
84 | pages.Add(new CodegenWizardPages.Step3_SummaryOfCodegenPage());
85 |
86 | // Set wizard pages
87 | wizard.SetPages(pages.ToArray());
88 |
89 | // Show wizard
90 | wizard.ShowDialog(this);
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/ClientCommon/AsyncWorkRequest.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Microsoft Corporation
2 | // Licensed under the Apache License, Version 2.0 (the "License");
3 | // You may not use this file except in compliance with the License.
4 | // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5 |
6 | // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
7 | // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8 | // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
9 | // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | // MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | // See the Apache 2 License for the specific language governing
13 | // permissions and limitations under the License.
14 |
15 | using System;
16 | using System.Net;
17 | using System.ComponentModel;
18 |
19 | namespace Microsoft.Synchronization.ClientServices
20 | {
21 | ///
22 | /// Utility class to denote an async work that is to be done
23 | ///
24 | class AsyncWorkRequest
25 | {
26 | Action _workerCallback;
27 | Action