本文整理匯總了C#中AbstractConnection.TflBatchEntity方法的典型用法代碼示例。如果您正苦於以下問題:C# AbstractConnection.TflBatchEntity方法的具體用法?C# AbstractConnection.TflBatchEntity怎麽用?C# AbstractConnection.TflBatchEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AbstractConnection
的用法示例。
在下文中一共展示了AbstractConnection.TflBatchEntity方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Check
public bool Check(AbstractConnection connection) {
var hashCode = connection.Folder.GetHashCode();
if (Checks.ContainsKey(hashCode)) {
return Checks[hashCode];
}
try {
using (var indexDirectory = LuceneDirectoryFactory.Create(connection, connection.TflBatchEntity(_processName))) {
using (var reader = IndexReader.Open(indexDirectory, true)) {
connection.Logger.Debug("Successfully connected to lucene index in {0}.", connection.Folder);
Checks[hashCode] = true;
return true;
}
}
} catch (Exception ex) {
_logger.Warn("Failed to connect to a lucene index in {0}.", connection.Folder);
_logger.Debug(ex.Message);
var exists = new DirectoryInfo(connection.Folder).Exists;
Checks[hashCode] = exists;
return exists;
}
}