protected PowerShellResults <L> SetObject <O, U, L>(string setCmdlet, Identity identity, U properties, Identity identityForGetCmdlet) where O : L where U : SetObjectProperties { EcpPerfCounters.WebServiceSetObject.Increment(); identity.FaultIfNull(); properties.FaultIfNull(); PowerShellResults <L> powerShellResults = new PowerShellResults <L>(); properties.IgnoreNullOrEmpty = false; if (properties.Any <KeyValuePair <string, object> >()) { powerShellResults = this.CoreInvoke <L>(new PSCommand().AddCommand(setCmdlet), identity.ToPipelineInput(), identity, properties); } if (powerShellResults.Succeeded && null != identityForGetCmdlet) { PowerShellResults <L> powerShellResults2 = null; if (properties.ReturnObjectType == ReturnObjectTypes.Full && this is IGetObjectService <O> ) { IGetObjectService <O> getObjectService = this as IGetObjectService <O>; PowerShellResults <O> @object = getObjectService.GetObject(identityForGetCmdlet); powerShellResults2 = new PowerShellResults <L>(); powerShellResults2.MergeOutput(@object.Output.Cast <L>().ToArray <L>()); powerShellResults2.MergeErrors <O>(@object); } else if (properties.ReturnObjectType == ReturnObjectTypes.PartialForList && this is IGetObjectForListService <L> ) { IGetObjectForListService <L> getObjectForListService = this as IGetObjectForListService <L>; powerShellResults2 = getObjectForListService.GetObjectForList(identityForGetCmdlet); } if (powerShellResults2 != null) { powerShellResults.MergeAll(powerShellResults2); } } return(powerShellResults); }
protected PowerShellResults <O> InvokeAndGetObject <O>(PSCommand psCommand, Identity[] identities, WebServiceParameters parameters) where O : BaseRow { PowerShellResults <O> powerShellResults = new PowerShellResults <O>(); powerShellResults.MergeErrors(this.Invoke(psCommand, identities, parameters)); if (powerShellResults.Succeeded && identities.Length <= 5) { IGetObjectForListService <O> getObjectForListService = this as IGetObjectForListService <O>; Func <Identity, PowerShellResults <O> > func; if (getObjectForListService != null) { func = ((Identity x) => getObjectForListService.GetObjectForList(x)); } else { IGetObjectService <O> getObjectService = this as IGetObjectService <O>; if (getObjectService == null) { throw new Exception("Either IGetObjectForListService or IGetObjectService must be implemented for single row refresh."); } func = ((Identity x) => getObjectService.GetObject(x)); } PowerShellResults <O> powerShellResults2 = new PowerShellResults <O>(); try { for (int i = 0; i < identities.Length; i++) { powerShellResults2.MergeAll(func(identities[i])); if (powerShellResults2.Failed) { break; } } } catch (SecurityException) { if (powerShellResults2.HasValue) { throw; } } if (powerShellResults2.SucceededWithValue) { powerShellResults.MergeAll(powerShellResults2); } } return(powerShellResults); }
public IBusinessObjectWithIdentity GetObject(string uniqueIdentifier) { IGetObjectService service = GetGetObjectService(); return(service.GetObject(this, uniqueIdentifier)); }