当前位置: 首页>>代码示例>>C#>>正文


C# IKey类代码示例

本文整理汇总了C#中IKey的典型用法代码示例。如果您正苦于以下问题:C# IKey类的具体用法?C# IKey怎么用?C# IKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IKey类属于命名空间,在下文中一共展示了IKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryGet

 public bool TryGet(IKey key, out IEntry entry)
 {
     Entry tempEntry;
     var result = _entries.TryGetValue(key, out tempEntry) && !tempEntry.IsReserved;
     entry = result ? tempEntry : null;
     return result;
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:7,代码来源:TableOfContent.cs

示例2: deletePair

        public bool deletePair(IKey key, bool firstCall = false)
        {
            bool canRemoveKey = true;
            if(firstCall)
                canRemoveKey = m_rkm.removeKey(key);

            if (!canRemoveKey)
                return false;

            bool retVal = m_pairsManager.removePair(key);
            //the key is in the local server
            if (retVal)
            {
                m_pairsManager.saveToDisk();
                return retVal;
            }
            //if key doesn't exists on the server need ask the ring for it
            String serviceAddress = m_nextServer.Channel + "://" + m_nextServer.ServerAddress + ":" + m_nextServer.ServerPort + "/" + m_nextServer.ServiceName;

            //Creating server proxy
            IServer svc = (IServer)Activator.GetObject(
                                    typeof(IServer),
                                    serviceAddress);

            try
            {
                return svc.deletePair(key);
            }
            catch (Exception)
            {
                m_rkm.removeServerFromRKM(m_nextServer);
                return false;
            }
        }
开发者ID:pepipe,项目名称:ISEL,代码行数:34,代码来源:Server.cs

示例3: AddKey

 public void AddKey(IKey key)
 {
     lock (this)
     {
         _keys.AddLast(key.Key);
     }
 }
开发者ID:Baptista,项目名称:SD,代码行数:7,代码来源:Program.cs

示例4: EqualTo

 /// <summary>
 /// Value equality for two IKey's
 /// </summary>
 /// <returns>true if all parts of of the keys are the same</returns>
 public static bool EqualTo(this IKey key, IKey other)
 {
     return (key.Base == other.Base)
         && (key.TypeName == other.TypeName)
         && (key.ResourceId == other.ResourceId)
         && (key.VersionId == other.VersionId);
 }
开发者ID:raysearchlabs,项目名称:spark,代码行数:11,代码来源:KeyExtensions.cs

示例5: DeletePair

        public void DeletePair(IKey key)
        {
            if (_manager.Trykey(key))
                {
                    if (_hashtable.ContainsKey(key.Key))
                    {

                        _manager.RemoveKey(key);
                        _hashtable.Remove(key.Key);
                    }
                    else
                    {
                        bool b = true;
                        while (b)
                        {
                            try
                            {

                                if (_nextserverUri == null) return;
                                _mysuccessorServer.DeletePair(key);
                                b = false;
                            }
                            catch (Exception ex)
                            {
                                if (ex is WebException || ex is RemotingException)
                                {

                                    _manager.RemakeRing(_nextserverUri);
                                }
                            }
                        }
                    }
                }
        }
开发者ID:Baptista,项目名称:SD,代码行数:34,代码来源:Class1.cs

示例6: TryOneRequest

        async Task<RegisterOperationResult?> TryOneRequest(IKey key, KeyRegisterRequest request,
            CancellationToken cancellationToken)
        {
            try
            {
                var result = await key.RegisterAsync(request, cancellationToken);

                log.Info(result.Status.ToString());
                switch (result.Status)
                {
                    case KeyResponseStatus.Success:
                        return RegisterOperationResult.Success(request, result.Data);
                }
            }
            catch (KeyGoneException)
            {
                // No sense in continuing with this signer, the key isn't physically present anymore
                log.DebugFormat("Key '{0}' is gone", keyId);
                throw;
            }
            catch (TaskCanceledException)
            {
                // Let cancellation bubble up
                throw;
            }
            catch (KeyBusyException)
            {
                // Maybe it won't be busy later
            }
            catch (Exception exception)
            {
                log.Error("Authenticate request failed", exception);
            }
            return null;
        }
开发者ID:vbfox,项目名称:U2FExperiments,代码行数:35,代码来源:RegisterOperation.cs

示例7: HasTypeName

 public static void HasTypeName(IKey key)
 {
     if (string.IsNullOrEmpty(key.TypeName))
     {
         throw Error.BadRequest("Resource type is missing: {0}", key);
     }
 }
开发者ID:Condeti,项目名称:spark,代码行数:7,代码来源:Validate.cs

示例8: BTree

		public BTree(uint topSid, SegmentManager sm, IKey keyFactory)
		{
			this.m_top_sid = topSid;
			this.m_sgManager = sm;
			this.m_keyFactory = keyFactory;
			this.m_nodeFactory = new BNode();
		}
开发者ID:luanzhu,项目名称:OOD.NET,代码行数:7,代码来源:BTree.cs

示例9: GetKeyFactory

        public virtual EntityKeyFactory GetKeyFactory(IKey key)
            => _cache.GetOrAdd(
                key,
                k =>
                    {
                        if (k.Properties.Count == 1)
                        {
                            var keyProperty = k.Properties[0];
                            var keyType = keyProperty.ClrType;

                            // Use composite key for anything with structural (e.g. byte[]) properties even if they are
                            // not composite because it is setup to do structural comparisons and the generic typing
                            // advantages of the simple key don't really apply anyway.
                            if (!typeof(IStructuralEquatable).GetTypeInfo().IsAssignableFrom(keyType.GetTypeInfo()))
                            {
                                var sentinel = keyProperty.SentinelValue;

                                return (EntityKeyFactory)(sentinel == null
                                    ? Activator.CreateInstance(
                                        typeof(SimpleNullSentinelEntityKeyFactory<>).MakeGenericType(keyType.UnwrapNullableType()), k)
                                    : Activator.CreateInstance(
                                        typeof(SimpleEntityKeyFactory<>).MakeGenericType(keyType.UnwrapNullableType()), k, sentinel));
                            }
                        }

                        return new CompositeEntityKeyFactory(k);
                    });
开发者ID:491134648,项目名称:EntityFramework,代码行数:27,代码来源:EntityKeyFactorySource.cs

示例10: Get

        public IEntry Get(IKey key)
        {
            IEntry entry;
            if (TryGet(key, out entry))
                return entry;

            throw new EntryNotFoundException(key);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:8,代码来源:CompositeTableOfContent.cs

示例11: Add

        public override void Add(string name, IKey key)
        {
            string keyPath = Path.Combine (this.path, name);

            if (File.Exists (keyPath + privateSuffix) || File.Exists (keyPath + publicSuffix))
                throw new ArgumentException ("Key with that name already exists");

            WriteKey (key, name);
        }
开发者ID:hultqvist,项目名称:Whisper,代码行数:9,代码来源:DiskKeyStorage.cs

示例12: TryRemove

        public bool TryRemove(IKey key)
        {
            var fragments = _fragments;
            foreach (var fragment in fragments)
                if (fragment.TableOfContent.Contains(key))
                    return fragment.TryRemove(key);

            return false;
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:9,代码来源:CompositeStorage.cs

示例13: TryGet

        public bool TryGet(IKey key, out IEntry entry)
        {
            foreach (var fragment in _fragments)
                if (fragment.TableOfContent.TryGet(key, out entry))
                    return true;

            entry = null;
            return false;
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:9,代码来源:CompositeTableOfContent.cs

示例14: For

 public override IEnumerable<IAnnotation> For(IKey key)
 {
     if (key.SqlServer().IsClustered.HasValue)
     {
         yield return new Annotation(
              SqlServerAnnotationNames.Prefix + SqlServerAnnotationNames.Clustered,
              key.SqlServer().IsClustered.Value);
     }
 }
开发者ID:adwardliu,项目名称:EntityFramework,代码行数:9,代码来源:SqlServerMigrationsAnnotationProvider.cs

示例15: put

 private void put(IKey key, int level, IEnumerable<Resource> resources)
 {
     if (resources == null) return;
     foreach (var resource in resources)
     {
         if (resource is DomainResource)
         put(key, level, resource as DomainResource);
     }
 }
开发者ID:raysearchlabs,项目名称:spark,代码行数:9,代码来源:MongoIndexer.cs


注:本文中的IKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。