本文整理汇总了C#中IKey类的典型用法代码示例。如果您正苦于以下问题:C# IKey类的具体用法?C# IKey怎么用?C# IKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IKey类属于命名空间,在下文中一共展示了IKey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Set
protected void Set(IKey key)
{
Id = key.Id;
OwnerUserId = key.OwnerUserId;
BlobId = key.BlobId;
Secure = key.Secure;
if (key.KeyData != null)
KeyData = (byte[])key.KeyData.Clone();
}
开发者ID:aluitink,项目名称:Ojibwe,代码行数:9,代码来源:Key.cs
示例17: KeyInteractionEventArgs
public KeyInteractionEventArgs( IKey k, IKeyProgram p, KeyInteractionEventType eventType )
: base(k)
{
EventType = eventType;
// Clone the commands: the emitted commands is a snapshot of the commands
// at the time of the event.
string[] copy = p.Commands.ToArray();
Commands = new CKReadOnlyListOnIList<string>( copy );
}
开发者ID:rit3k,项目名称:ck-certified,代码行数:9,代码来源:KeyInteractionEventArgs.cs
示例18: TryGet
public bool TryGet(IKey key, out byte[] content)
{
foreach (var fragment in _fragments)
if (fragment.TryGet(key, out content))
return true;
content = null;
return false;
}
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:9,代码来源:CompositeStorage.cs
示例19: ValidateDtoData
protected static Collection<Dictionary<string, string>> ValidateDtoData(IKey dto, EntityBase entity)
{
var retVal = new Collection<Dictionary<string, string>>();
var fieldName = string.Empty;
foreach (var inputField in dto.GetType().GetProperties().Where(x => x.Name != "Key" && x.GetValue(dto) != null)) {
if (inputField.Name.StartsWith("Start_")) {
fieldName = inputField.Name.Substring(6);
} else if(inputField.Name.StartsWith("End_")){
fieldName = inputField.Name.Substring(4);
} else if(inputField.Name.Contains("__")) {
// using field from a different table
// not currently handling this case
} else {
fieldName = inputField.Name;
}
// insure the entity contains the field represented by fieldName
var entityFieldName = entity.GetType().GetProperty(fieldName);
if (entityFieldName == null || entityFieldName.Name.Length == 0) {
// entity does not contain this field
continue;
}
if (entity.GetDataType(fieldName) == typeof(string)) {
// should be ok
continue;
}
if (entity.GetDataType(fieldName) == typeof(int) || entity.GetDataType(fieldName) == typeof(int?)) {
var nbr = 0;
if (!int.TryParse(inputField.GetValue(dto).ToString(), out nbr)) {
var dic = new Dictionary<string, string> {{inputField.Name, "Invalid data type cast"}};
retVal.Add(dic);
}
if (entity.GetDataType(fieldName) == typeof(bool) || entity.GetDataType(fieldName) == typeof(bool?)) {
if (inputField.GetValue(dto).ToString().ToLower() != "true" && inputField.GetValue(dto).ToString().ToLower() != "false") {
var dic = new Dictionary<string, string> { { inputField.Name, "Invalid data type cast" } };
retVal.Add(dic);
}
}
if (entity.GetDataType(fieldName) == typeof(DateTime) || entity.GetDataType(fieldName) == typeof(DateTime?)) {
DateTime dt;
if (!DateTime.TryParse(inputField.GetValue(dto).ToString(), out dt)) {
var dic = new Dictionary<string, string> { { inputField.Name, "Invalid data type cast" } };
retVal.Add(dic);
}
}
if (entity.GetDataType(fieldName) == typeof(decimal) || entity.GetDataType(fieldName) == typeof(decimal?)) {
decimal d;
if (!decimal.TryParse(inputField.GetValue(dto).ToString(), out d)) {
var dic = new Dictionary<string, string> { { inputField.Name, "Invalid data type cast" } };
retVal.Add(dic);
}
}
}
}
return retVal;
}
开发者ID:Stimulant-Software,项目名称:HarvestSelect,代码行数:56,代码来源:BaseApiController.cs
示例20: put
private void put(IKey key, int level, Resource resource)
{
if (resource is DomainResource)
{
DomainResource d = resource as DomainResource;
put(key, level, d);
put(key, level + 1, d.Contained);
}
}
开发者ID:Condeti,项目名称:spark,代码行数:10,代码来源:MongoIndexer.cs
注:本文中的IKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论