本文整理汇总了C#中IFilter.SingleOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# IFilter.SingleOrDefault方法的具体用法?C# IFilter.SingleOrDefault怎么用?C# IFilter.SingleOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFilter
的用法示例。
在下文中一共展示了IFilter.SingleOrDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryReference
private async Task<Resource[]> QueryReference(
IQueryParameters parameters,
string correlationIdentifier)
{
if (null == parameters)
{
throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameParameters);
}
if (string.IsNullOrWhiteSpace(correlationIdentifier))
{
throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameCorrelationIdentifier);
}
if (null == parameters.RequestedAttributePaths || !parameters.RequestedAttributePaths.Any())
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
string selectedAttribute = parameters.RequestedAttributePaths.SingleOrDefault();
if (string.IsNullOrWhiteSpace(selectedAttribute))
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
ProvisioningAgentMonitor.Instance.Inform(selectedAttribute, true, correlationIdentifier);
if
(
!string.Equals(
selectedAttribute,
Microsoft.SystemForCrossDomainIdentityManagement.AttributeNames.Identifier,
StringComparison.OrdinalIgnoreCase)
)
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
if (null == parameters.AlternateFilters)
{
throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters);
}
if (string.IsNullOrWhiteSpace(parameters.SchemaIdentifier))
{
throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters);
}
string informationAlternateFilterCount = parameters.AlternateFilters.Count.ToString(CultureInfo.InvariantCulture);
ProvisioningAgentMonitor.Instance.Inform(informationAlternateFilterCount, true, correlationIdentifier);
if (parameters.AlternateFilters.Count != 1)
{
string exceptionMessage =
string.Format(
CultureInfo.InvariantCulture,
ProvisioningAgentResources.ExceptionFilterCountTemplate,
1,
parameters.AlternateFilters.Count);
throw new NotSupportedException(exceptionMessage);
}
AmazonWebServicesProvider.Validate(parameters);
IFilter filterPrimary = parameters.AlternateFilters.Single();
if (null == filterPrimary.AdditionalFilter)
{
throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters);
}
IFilter filterAdditional = filterPrimary.AdditionalFilter;
if (filterAdditional.AdditionalFilter != null)
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
IReadOnlyCollection<IFilter> filters =
new IFilter[]
{
filterPrimary,
filterAdditional
};
IFilter filterIdentifier =
filters
.SingleOrDefault(
(IFilter item) =>
string.Equals(
AttributeNames.Identifier,
item.AttributePath,
StringComparison.OrdinalIgnoreCase));
if (null == filterIdentifier)
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
IFilter filterReference =
filters
.SingleOrDefault(
(IFilter item) =>
string.Equals(
AttributeNames.Members,
//.........这里部分代码省略.........
示例2: QueryReference
private async Task<Resource[]> QueryReference(IQueryParameters parameters, string correlationIdentifier)
{
if (null == parameters)
{
throw new ArgumentNullException(FileProvider.ArgumentNameParameters);
}
if (string.IsNullOrWhiteSpace(correlationIdentifier))
{
throw new ArgumentNullException(FileProvider.ArgumentNameCorrelationIdentifier);
}
if (null == parameters.RequestedAttributePaths || !parameters.RequestedAttributePaths.Any())
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
string selectedAttribute = parameters.RequestedAttributePaths.SingleOrDefault();
if (string.IsNullOrWhiteSpace(selectedAttribute))
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
ProvisioningAgentMonitor.Instance.Inform(selectedAttribute, true, correlationIdentifier);
if
(
!string.Equals(
selectedAttribute,
Microsoft.SystemForCrossDomainIdentityManagement.AttributeNames.Identifier,
StringComparison.OrdinalIgnoreCase)
)
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
if (null == parameters.AlternateFilters)
{
throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters);
}
if (string.IsNullOrWhiteSpace(parameters.SchemaIdentifier))
{
throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters);
}
string informationAlternateFilterCount = parameters.AlternateFilters.Count.ToString(CultureInfo.InvariantCulture);
ProvisioningAgentMonitor.Instance.Inform(informationAlternateFilterCount, true, correlationIdentifier);
if (parameters.AlternateFilters.Count != 1)
{
string exceptionMessage =
string.Format(
CultureInfo.InvariantCulture,
ProvisioningAgentResources.ExceptionFilterCountTemplate,
1,
parameters.AlternateFilters.Count);
throw new NotSupportedException(exceptionMessage);
}
IReadOnlyCollection<string> requestedColumns = this.IdentifyRequestedColumns(parameters);
IFilter filterPrimary = parameters.AlternateFilters.Single();
if (null == filterPrimary.AdditionalFilter)
{
throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters);
}
IFilter filterAdditional = filterPrimary.AdditionalFilter;
if (filterAdditional.AdditionalFilter != null)
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
IReadOnlyCollection<IFilter> filters =
new IFilter[]
{
filterPrimary,
filterAdditional
};
IFilter filterIdentifier =
filters
.SingleOrDefault(
(IFilter item) =>
string.Equals(
AttributeNames.Identifier,
item.AttributePath,
StringComparison.OrdinalIgnoreCase));
if (null == filterIdentifier)
{
throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery);
}
IRow row;
IFilter filterReference =
filters
.SingleOrDefault(
(IFilter item) =>
string.Equals(
AttributeNames.Members,
//.........这里部分代码省略.........