本文整理汇总了C#中IStorageActionsAccessor.GetConfig方法的典型用法代码示例。如果您正苦于以下问题:C# IStorageActionsAccessor.GetConfig方法的具体用法?C# IStorageActionsAccessor.GetConfig怎么用?C# IStorageActionsAccessor.GetConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStorageActionsAccessor
的用法示例。
在下文中一共展示了IStorageActionsAccessor.GetConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrDefault
public static SynchronizationConfig GetOrDefault(IStorageActionsAccessor accessor)
{
try
{
if (accessor.ConfigExists(SynchronizationConstants.RavenSynchronizationConfig) == false)
return new SynchronizationConfig(); // return a default one
return accessor.GetConfig(SynchronizationConstants.RavenSynchronizationConfig).JsonDeserialization<SynchronizationConfig>();
}
catch (Exception e)
{
Log.Warn("Could not deserialize a synchronization configuration", e);
return new SynchronizationConfig(); // return a default one
}
}
示例2: TimeoutExceeded
public bool TimeoutExceeded(string fileName, IStorageActionsAccessor accessor)
{
SynchronizationLock syncLock;
try
{
syncLock = accessor.GetConfig(RavenFileNameHelper.SyncLockNameForFile(fileName)).JsonDeserialization<SynchronizationLock>();
}
catch (FileNotFoundException)
{
return true;
}
return (DateTime.UtcNow - syncLock.FileLockedAt).TotalMilliseconds > SynchronizationConfigAccessor.GetOrDefault(accessor).SynchronizationLockTimeoutMiliseconds;
}
示例3: TimeoutExceeded
public bool TimeoutExceeded(string fileName, IStorageActionsAccessor accessor)
{
SynchronizationLock syncLock;
try
{
syncLock =
accessor.GetConfig(RavenFileNameHelper.SyncLockNameForFile(fileName)).AsObject<SynchronizationLock>();
}
catch (FileNotFoundException)
{
return true;
}
return DateTime.UtcNow - syncLock.FileLockedAt > SynchronizationTimeout(accessor);
}
示例4: TryGetDeserializedConfig
private static bool TryGetDeserializedConfig(IStorageActionsAccessor accessor, string configurationName, out FileVersioningConfiguration fileVersioningConfiguration)
{
if (accessor.ConfigExists(configurationName) == false)
{
fileVersioningConfiguration = null;
return false;
}
var configuration = accessor.GetConfig(configurationName);
if (configuration == null)
{
fileVersioningConfiguration = null;
return false;
}
fileVersioningConfiguration = configuration.JsonDeserialization<FileVersioningConfiguration>();
return true;
}
示例5: GetLastSynchronization
private SourceSynchronizationInformation GetLastSynchronization(Guid from, IStorageActionsAccessor accessor)
{
SourceSynchronizationInformation info;
try
{
info =
accessor.GetConfig(SynchronizationConstants.RavenSynchronizationSourcesBasePath + "/" + from).AsObject
<SourceSynchronizationInformation>();
}
catch (FileNotFoundException)
{
info = new SourceSynchronizationInformation
{
LastSourceFileEtag = Guid.Empty,
DestinationServerId = Storage.Id
};
}
return info;
}