本文整理汇总了C#中System.Management.Automation.PSCmdlet.WriteObject方法的典型用法代码示例。如果您正苦于以下问题:C# PSCmdlet.WriteObject方法的具体用法?C# PSCmdlet.WriteObject怎么用?C# PSCmdlet.WriteObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Management.Automation.PSCmdlet
的用法示例。
在下文中一共展示了PSCmdlet.WriteObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCmdletBase
public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
{
ManagementService client = CreateManagementServiceClient();
var relyingParties = client.RelyingParties;
List<string> relyingPartyNames = new List<string>();
foreach (var relyingParty in relyingParties)
{
string name = relyingParty.Name;
relyingPartyNames.Add(name);
}
callingCmdlet.WriteObject(relyingPartyNames, true);
}
示例2: ExecuteCmdletBase
public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
{
if (Domain == null)
{
callingCmdlet.WriteWarning("No valid domain has been provided.");
return;
}
if (!Domain.CheckIsValid())
{
callingCmdlet.WriteWarning("An invalid domain object has been provided.");
return;
}
Model.IDatabaseInfo dbInfo = Domain;
using (MappingToolDatabaseDataContext dataContext = new MappingToolDatabaseDataContext(dbInfo.ConnectionString))
{
dataContext.CommandTimeout = 180;
if (MapId != Guid.Empty)
{
/// Find maps by ID.
///
Model.Map map = GetMapById(dataContext, MapId);
callingCmdlet.WriteObject(map);
}
else if (!string.IsNullOrEmpty(MapName))
{
/// Find maps by name.
///
List<Model.Map> maps = GetMapsByName(dataContext, MapName);
callingCmdlet.WriteObject(maps, true);
}
else
{
/// Fine all maps.
///
List<Model.Map> maps = GetAllMaps(dataContext);
callingCmdlet.WriteObject(maps, true);
}
}
}
示例3: ExecuteCmdletBase
public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
{
ManagementService client = CreateManagementServiceClient();
var relyingParties = client.RelyingParties;
List<string> relyingPartyRelayAddresses = new List<string>();
long relyingPartyId = -1;
foreach (var relyingParty in relyingParties)
{
string name = relyingParty.Name;
if (name == RelyingParty)
{
relyingPartyId = relyingParty.Id;
}
}
foreach (RelyingPartyAddress address in client.RelyingPartyAddresses)
{
if (address.RelyingPartyId == relyingPartyId)
{
relyingPartyRelayAddresses.Add(address.Address);
}
}
callingCmdlet.WriteObject(relyingPartyRelayAddresses, true); ;
}
示例4: ExecuteCmdletBase
public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
{
using (MappingToolDatabaseDataContext dataContext = new MappingToolDatabaseDataContext(ConnectionString))
{
dataContext.CommandTimeout = 180;
if (DomainId != Guid.Empty)
{
/// Find domains by domain ID.
///
Model.Domain domain = GetDomainById(dataContext, DomainId);
callingCmdlet.WriteObject(domain);
}
else if (!string.IsNullOrEmpty(DomainName))
{
/// Find domains by domain name.
///
List<Model.Domain> domains = GetDomainsByName(dataContext, DomainName);
callingCmdlet.WriteObject(domains, true);
}
else
{
/// Find all domains.
///
List<Model.Domain> domains = GetAllDomains(dataContext);
callingCmdlet.WriteObject(domains, true);
}
}
}