本文整理汇总了C#中ISession.CreateOperationContext方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.CreateOperationContext方法的具体用法?C# ISession.CreateOperationContext怎么用?C# ISession.CreateOperationContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.CreateOperationContext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
// Create session.
session = Auth.Auth.GetCmisSession(repoinfo.Address.ToString(), repoinfo.User, repoinfo.Password.ToString(), repoinfo.RepoID);
Logger.Debug("Created CMIS session: " + session.ToString());
// Detect repository capabilities.
ChangeLogCapability = session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
IsGetDescendantsSupported = session.RepositoryInfo.Capabilities.IsGetDescendantsSupported == true;
IsGetFolderTreeSupported = session.RepositoryInfo.Capabilities.IsGetFolderTreeSupported == true;
Config.SyncConfig.Folder folder = ConfigManager.CurrentConfig.GetFolder(this.repoinfo.Name);
if (folder != null)
{
Config.Feature features = folder.SupportedFeatures;
if (features != null)
{
if (IsGetDescendantsSupported && features.GetDescendantsSupport == false)
IsGetDescendantsSupported = false;
if (IsGetFolderTreeSupported && features.GetFolderTreeSupport == false)
IsGetFolderTreeSupported = false;
if (ChangeLogCapability && features.GetContentChangesSupport == false)
ChangeLogCapability = false;
if (ChangeLogCapability && session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.Properties)
IsPropertyChangesSupported = true;
}
}
Logger.Debug("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Debug("Get folder tree support: " + IsGetFolderTreeSupported.ToString());
Logger.Debug("Get descendants support: " + IsGetDescendantsSupported.ToString());
if (repoinfo.ChunkSize > 0)
{
Logger.Debug("Chunked Up/Download enabled: chunk size = " + repoinfo.ChunkSize.ToString() + " byte");
}
else
{
Logger.Debug("Chunked Up/Download disabled");
}
HashSet<string> filters = new HashSet<string>();
filters.Add("cmis:objectId");
filters.Add("cmis:name");
filters.Add("cmis:contentStreamFileName");
filters.Add("cmis:contentStreamLength");
filters.Add("cmis:lastModificationDate");
filters.Add("cmis:lastModifiedBy");
filters.Add("cmis:path");
filters.Add("cmis:changeToken"); // Needed to send update commands, see https://github.com/aegif/CmisSync/issues/516
session.DefaultContext = session.CreateOperationContext(filters, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
}
示例2: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
// Create session factory.
SessionFactory factory = SessionFactory.NewInstance();
session = factory.CreateSession(cmisParameters);
// Detect whether the repository has the ChangeLog capability.
Logger.Debug("Created CMIS session: " + session.ToString());
ChangeLogCapability = session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
IsGetDescendantsSupported = session.RepositoryInfo.Capabilities.IsGetDescendantsSupported == true;
IsGetFolderTreeSupported = session.RepositoryInfo.Capabilities.IsGetFolderTreeSupported == true;
Config.SyncConfig.Folder folder = ConfigManager.CurrentConfig.getFolder(this.repoinfo.Name);
if (folder != null)
{
Config.Feature features = folder.SupportedFeatures;
if (features != null)
{
if (IsGetDescendantsSupported && features.GetDescendantsSupport == false)
IsGetDescendantsSupported = false;
if (IsGetFolderTreeSupported && features.GetFolderTreeSupport == false)
IsGetFolderTreeSupported = false;
if (ChangeLogCapability && features.GetContentChangesSupport == false)
ChangeLogCapability = false;
if(ChangeLogCapability && session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.Properties)
IsPropertyChangesSupported = true;
}
}
Logger.Debug("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Debug("Get folder tree support: " + IsGetFolderTreeSupported.ToString());
Logger.Debug("Get descendants support: " + IsGetDescendantsSupported.ToString());
if(repoinfo.ChunkSize>0) {
Logger.Debug("Chunked Up/Download enabled: chunk size = "+ repoinfo.ChunkSize.ToString() + " byte");
}else {
Logger.Debug("Chunked Up/Download disabled");
}
HashSet<string> filters = new HashSet<string>();
filters.Add("cmis:objectId");
filters.Add("cmis:name");
filters.Add("cmis:contentStreamFileName");
filters.Add("cmis:contentStreamLength");
filters.Add("cmis:lastModificationDate");
filters.Add("cmis:lastModifiedBy");
filters.Add("cmis:path");
session.DefaultContext = session.CreateOperationContext(filters, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
}
示例3: CreateContext
/// <summary>
/// Creates an operation context.
/// </summary>
/// <returns>The context.</returns>
/// <param name="session">Cmis session.</param>
/// <param name="cacheEnabled">If set to <c>true</c> cache enabled.</param>
/// <param name="includePathSegments">If set to <c>true</c> include path segments.</param>
/// <param name="elements">Requested cmis elements.</param>
public static IOperationContext CreateContext(ISession session, bool cacheEnabled, bool includePathSegments, params string[] elements) {
HashSet<string> filter = CreateFilter(elements);
HashSet<string> renditions = new HashSet<string>();
renditions.Add("cmis:none");
return session.CreateOperationContext(
filter: filter,
includeAcls: false,
includeAllowableActions: true,
includePolicies: false,
includeRelationships: IncludeRelationshipsFlag.None,
renditionFilter: renditions,
includePathSegments: includePathSegments,
orderBy: null,
cacheEnabled: cacheEnabled,
maxItemsPerPage: MaximumItemsPerPage);
}
示例4: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
if (_session == null)
{
// Create session.
_session = Auth.Auth.GetCmisSession(SyncFolderInfo.Account.RemoteUrl, SyncFolderInfo.Account.Credentials, SyncFolderInfo.RepositoryId);
Logger.Debug("Created CMIS session: " + _session.ToString());
// Detect repository capabilities.
ChangeLogCapability = _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
IsGetDescendantsSupported = _session.RepositoryInfo.Capabilities.IsGetDescendantsSupported == true;
IsGetFolderTreeSupported = _session.RepositoryInfo.Capabilities.IsGetFolderTreeSupported == true;
Config.Feature features = SyncFolderInfo.SupportedFeatures;
if (features != null)
{
if (IsGetDescendantsSupported && features.GetDescendantsSupport == false)
IsGetDescendantsSupported = false;
if (IsGetFolderTreeSupported && features.GetFolderTreeSupport == false)
IsGetFolderTreeSupported = false;
if (ChangeLogCapability && features.GetContentChangesSupport == false)
ChangeLogCapability = false;
if (ChangeLogCapability && _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.Properties)
IsPropertyChangesSupported = true;
}
Logger.Debug("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Debug("Get folder tree support: " + IsGetFolderTreeSupported.ToString());
Logger.Debug("Get descendants support: " + IsGetDescendantsSupported.ToString());
if (SyncFolderInfo.ChunkSize > 0)
{
Logger.Debug("Chunked Up/Download enabled: chunk size = " + SyncFolderInfo.ChunkSize.ToString() + " byte");
}
else
{
Logger.Debug("Chunked Up/Download disabled");
}
HashSet<string> filters = new HashSet<string>();
filters.Add("cmis:objectId");
filters.Add("cmis:name");
filters.Add("cmis:contentStreamFileName");
filters.Add("cmis:contentStreamLength");
filters.Add("cmis:lastModificationDate");
filters.Add("cmis:lastModifiedBy");
filters.Add("cmis:path");
filters.Add("cmis:changeToken"); // Needed to send update commands, see https://github.com/aegif/CmisSync/issues/516
_session.DefaultContext = _session.CreateOperationContext(filters, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
}
else
{
Logger.Warn("Connect() called, but the session is yet present");
}
}