Beispiel #1
0
        /// <summary>
        /// Возвращает только кешированные хранилища метаданнх для определенной реплики
        /// </summary>
        /// <param name="replicaId">The replica id.</param>
        /// <returns></returns>
        public static SyncMetadataStore OpenStore(SyncId replicaId)
        {
            SyncMetadataStore retVal = null;

            try
            {
                lock (_lock)
                {
                    ReplicaMetadataAdaptor replica;
                    if (!_replicaCache.TryGetValue(replicaId, out replica))
                    {
                        replica = ReplicaMetadataAdaptor.CreateInstance(replicaId);
                        if (replica != null)
                        {
                            _replicaCache.Add(replicaId, replica);
                        }
                    }

                    retVal = new SyncMetadataStore(replica);
                }
            }
            catch (ArgumentException)
            {
            }
            return(retVal);
        }
Beispiel #2
0
        /// <summary>
        /// Возвращает id реплики для определенного пользователя
        /// </summary>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        public static SyncId FindReplicaIdByPrincipalId(int principalId)
        {
            SyncId retVal = null;
            ReplicaMetadataAdaptor replicaMetaData = ReplicaMetadataAdaptor.CreateInstance(principalId);

            if (replicaMetaData != null)
            {
                retVal = replicaMetaData.ReplicaId;
            }

            return(retVal);
        }
Beispiel #3
0
        /// <summary>
        /// Создает хранилище метаданных реплики
        /// </summary>
        /// <param name="replicaId">The replica id.</param>
        /// <param name="idFormats">The id formats.</param>
        /// <returns></returns>
        public static SyncMetadataStore CreateStore(SyncId replicaId, int principalId)
        {
            SyncMetadataStore      retVal  = null;
            ReplicaMetadataAdaptor replica = ReplicaMetadataAdaptor.CreateInstance(replicaId, StaticIdFormats);

            if (replica != null)
            {
                replica.PrincipalId = principalId;
                replica.Save();
            }
            retVal = OpenStore(replicaId);
            return(retVal);
        }
Beispiel #4
0
 private SyncMetadataStore(ReplicaMetadataAdaptor replica)
 {
     _replicaMetaData = replica;
 }
Beispiel #5
0
 public SyncReplicaMetadata(SyncIdFormatGroup idFormats, SyncId replicaId, ReplicaMetadataAdaptor replica)
     : base(idFormats, replicaId)
 {
     Replica = replica;
 }
Beispiel #6
0
 private SyncMetadataStore(ReplicaMetadataAdaptor replica)
 {
     _replicaMetaData = replica;
 }
Beispiel #7
0
 public SyncReplicaMetadata(SyncIdFormatGroup idFormats, SyncId replicaId, ReplicaMetadataAdaptor replica)
     : base(idFormats, replicaId)
 {
     Replica = replica;
 }