Exemple #1
0
        private void InitializeMetadataStore()
        {
            // Values for adding a custom field to the metadata store
            List <FieldSchema> fields = new List <FieldSchema>();
            SyncId             id     = ReplicaId;

            // Create or open the metadata store, initializing it with the id formats we'll use to reference our items and endpoints
            if (!File.Exists(_replicaMetadataFile))
            {
                fields.Add(new FieldSchema(TIMESTAMP_COLUMNNAME, typeof(System.UInt64)));
                _metadataStore = SqlMetadataStore.CreateStore(_replicaMetadataFile);
                _metadata      = _metadataStore.InitializeReplicaMetadata(_idFormats, _replicaId, fields, null /*No indexes to create*/);
            }
            else
            {
                _metadataStore = SqlMetadataStore.OpenStore(_replicaMetadataFile);
                _metadata      = _metadataStore.GetReplicaMetadata(_idFormats, _replicaId);
            }
        }
        public void InitializeMetadataStore()
        {
            List <FieldSchema> fields = new List <FieldSchema>();

            if (!File.Exists(_replicaMetadataFile))
            {
                fields.Add(new FieldSchema(ID_COLUMNNAME, typeof(string), idLength));
                fields.Add(new FieldSchema(PATH_COLUMNNAME, typeof(string), pathLength));
                _metadataStore = SqlMetadataStore.CreateStore(_replicaMetadataFile);

                var indexes = new List <IndexSchema> {
                    new IndexSchema(ID_COLUMNNAME, false)
                };
                _metadata = _metadataStore.InitializeReplicaMetadata(_idFormats, new SyncId(Guid.NewGuid()), fields, indexes);
            }
            else
            {
                _metadataStore = SqlMetadataStore.OpenStore(_replicaMetadataFile);
                _metadata      = _metadataStore.GetSingleReplicaMetadata();
            }
            ReplicaId = _metadata.ReplicaId;
        }
        public void InitializeMetadataStore()
        {
            List<FieldSchema> fields = new List<FieldSchema>();

            if (!File.Exists(_replicaMetadataFile))
            {
                fields.Add(new FieldSchema(ID_COLUMNNAME, typeof(string), idLength));
                fields.Add(new FieldSchema(PATH_COLUMNNAME, typeof(string), pathLength));
                _metadataStore = SqlMetadataStore.CreateStore(_replicaMetadataFile);

                var indexes = new List<IndexSchema>{
                    new IndexSchema(ID_COLUMNNAME, false)
                };
                _metadata = _metadataStore.InitializeReplicaMetadata(_idFormats, new SyncId(Guid.NewGuid()), fields, indexes);
            }
            else
            {
                _metadataStore = SqlMetadataStore.OpenStore(_replicaMetadataFile);
                _metadata = _metadataStore.GetSingleReplicaMetadata();
            }
            ReplicaId = _metadata.ReplicaId;
        }
Exemple #4
0
        private void InitializeMetadataStore()
        {
            // Values for adding a custom field to the metadata store
            List<FieldSchema> fields = new List<FieldSchema>();
            SyncId id = ReplicaId;

            // Create or open the metadata store, initializing it with the id formats we'll use to reference our items and endpoints
            if (!File.Exists(_replicaMetadataFile))
            {
                fields.Add(new FieldSchema(TIMESTAMP_COLUMNNAME, typeof(System.UInt64)));
                _metadataStore = SqlMetadataStore.CreateStore(_replicaMetadataFile);
                _metadata = _metadataStore.InitializeReplicaMetadata(_idFormats, _replicaId, fields, null/*No indexes to create*/);
            }
            else
            {
                _metadataStore = SqlMetadataStore.OpenStore(_replicaMetadataFile);
                _metadata = _metadataStore.GetReplicaMetadata(_idFormats, _replicaId);
            }
        }