Beispiel #1
0
        public TestProvider(
            Guid replicaId,
            string metadataFilePath
            )
        {
            _metadataFilePath = metadataFilePath;
            _replicaId        = new SyncId(replicaId);

            //// Set ReplicaIdFormat to use a GUID as an ID, and ItemIdFormat to use a GUID plus
            //// an 8-byte prefix.
            //_idFormats = new SyncIdFormatGroup();
            //_idFormats.ItemIdFormat.IsVariableLength = false;
            //_idFormats.ItemIdFormat.Length = 24;
            //_idFormats.ReplicaIdFormat.IsVariableLength = false;
            //_idFormats.ReplicaIdFormat.Length = 16;

            this._idFormats = new SyncIdFormatGroup();
            this._idFormats.ChangeUnitIdFormat.IsVariableLength = false;
            this._idFormats.ChangeUnitIdFormat.Length           = (ushort)4;
            this._idFormats.ItemIdFormat.IsVariableLength       = false;
            this._idFormats.ItemIdFormat.Length = (ushort)24;
            this._idFormats.ReplicaIdFormat.IsVariableLength = false;
            this._idFormats.ReplicaIdFormat.Length           = (ushort)16;

            CreateMetadataStore(metadataFilePath);
            _metadataSchema = CreateMetadataSchema();
        }
Beispiel #2
0
        private ItemMetadataSchema CreateMetadataSchema()
        {
            var customFields = new CustomFieldDefinition[2];

            customFields[0] = new CustomFieldDefinition(CUSTOM_FIELD_ID, typeof(ulong));
            customFields[1] = new CustomFieldDefinition(CUSTOM_FIELD_TIMESTAMP, typeof(ulong));

            var identityRule = new IdentityRule[1];

            identityRule[0] = new IdentityRule(new uint[] { CUSTOM_FIELD_ID });

            var result = new ItemMetadataSchema(customFields, identityRule);

            return
                (result);
        }