Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,7 @@ public virtual void Execute(CmdletOperationBase cmdlet)
/// <see cref="CimSession"/>, <see cref="CimOperationOptions"/> object.
/// </para>
/// </summary>
protected XOperationContextBase Context
{
get
{
return this.context;
}

set
{
this.context = value;
}
}

private XOperationContextBase context;
protected XOperationContextBase Context { get; set; }
}

/// <summary>
Expand Down
139 changes: 21 additions & 118 deletions src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,19 @@ internal class ParameterDefinitionEntry
/// <param name="mandatory"></param>
internal ParameterDefinitionEntry(string parameterSetName, bool mandatory)
{
this.mandatory = mandatory;
this.parameterSetName = parameterSetName;
this.IsMandatory = mandatory;
this.ParameterSetName = parameterSetName;
}

/// <summary>
/// Property ParameterSetName.
/// </summary>
internal string ParameterSetName
{
get
{
return this.parameterSetName;
}
}

private readonly string parameterSetName = null;
internal string ParameterSetName { get; } = null;

/// <summary>
/// Whether the parameter is mandatory to the set.
/// </summary>
internal bool IsMandatory
{
get
{
return this.mandatory;
}
}

private readonly bool mandatory = false;
internal bool IsMandatory { get; } = false;
}

/// <summary>
Expand All @@ -75,8 +59,8 @@ internal class ParameterSetEntry
/// <param name="mandatoryParameterCount"></param>
internal ParameterSetEntry(UInt32 mandatoryParameterCount)
{
this.mandatoryParameterCount = mandatoryParameterCount;
this.isDefaultParameterSet = false;
this.MandatoryParameterCount = mandatoryParameterCount;
this.IsDefaultParameterSet = false;
reset();
}

Expand All @@ -86,8 +70,8 @@ internal ParameterSetEntry(UInt32 mandatoryParameterCount)
/// <param name="toClone"></param>
internal ParameterSetEntry(ParameterSetEntry toClone)
{
this.mandatoryParameterCount = toClone.MandatoryParameterCount;
this.isDefaultParameterSet = toClone.IsDefaultParameterSet;
this.MandatoryParameterCount = toClone.MandatoryParameterCount;
this.IsDefaultParameterSet = toClone.IsDefaultParameterSet;
reset();
}

Expand All @@ -98,8 +82,8 @@ internal ParameterSetEntry(ParameterSetEntry toClone)
/// <param name="mandatory"></param>
internal ParameterSetEntry(UInt32 mandatoryParameterCount, bool isDefault)
{
this.mandatoryParameterCount = mandatoryParameterCount;
this.isDefaultParameterSet = isDefault;
this.MandatoryParameterCount = mandatoryParameterCount;
this.IsDefaultParameterSet = isDefault;
reset();
}

Expand All @@ -108,107 +92,39 @@ internal ParameterSetEntry(UInt32 mandatoryParameterCount, bool isDefault)
/// </summary>
internal void reset()
{
this.setMandatoryParameterCount = this.setMandatoryParameterCountAtBeginProcess;
this.isValueSet = this.isValueSetAtBeginProcess;
this.SetMandatoryParameterCount = this.SetMandatoryParameterCountAtBeginProcess;
this.IsValueSet = this.IsValueSetAtBeginProcess;
}

/// <summary>
/// Property <c>DefaultParameterSet</c>
/// </summary>
internal bool IsDefaultParameterSet
{
get
{
return this.isDefaultParameterSet;
}
}

private readonly bool isDefaultParameterSet = false;
internal bool IsDefaultParameterSet { get; } = false;

/// <summary>
/// Property <c>MandatoryParameterCount</c>
/// </summary>
internal UInt32 MandatoryParameterCount
{
get
{
return this.mandatoryParameterCount;
}
}

private readonly UInt32 mandatoryParameterCount = 0;
internal UInt32 MandatoryParameterCount { get; } = 0;

/// <summary>
/// Property <c>IsValueSet</c>
/// </summary>
internal bool IsValueSet
{
get
{
return this.isValueSet;
}

set
{
this.isValueSet = value;
}
}

private bool isValueSet = false;
internal bool IsValueSet { get; set; } = false;

/// <summary>
/// Property <c>IsValueSetAtBeginProcess</c>
/// </summary>
internal bool IsValueSetAtBeginProcess
{
get
{
return this.isValueSetAtBeginProcess;
}

set
{
this.isValueSetAtBeginProcess = value;
}
}

private bool isValueSetAtBeginProcess = false;
internal bool IsValueSetAtBeginProcess { get; set; } = false;

/// <summary>
/// Property <c>SetMandatoryParameterCount</c>
/// </summary>
internal UInt32 SetMandatoryParameterCount
{
get
{
return this.setMandatoryParameterCount;
}

set
{
this.setMandatoryParameterCount = value;
}
}

private UInt32 setMandatoryParameterCount = 0;
internal UInt32 SetMandatoryParameterCount { get; set; } = 0;

/// <summary>
/// Property <c>SetMandatoryParameterCountAtBeginProcess</c>
/// </summary>
internal UInt32 SetMandatoryParameterCountAtBeginProcess
{
get
{
return this.setMandatoryParameterCountAtBeginProcess;
}

set
{
this.setMandatoryParameterCountAtBeginProcess = value;
}
}

private UInt32 setMandatoryParameterCountAtBeginProcess = 0;
internal UInt32 SetMandatoryParameterCountAtBeginProcess { get; set; } = 0;
}

/// <summary>
Expand Down Expand Up @@ -531,15 +447,15 @@ internal void CheckParameterSet()
{
try
{
this.parameterSetName = this.parameterBinder.GetParameterSet();
this.ParameterSetName = this.parameterBinder.GetParameterSet();
}
finally
{
this.parameterBinder.reset();
}
}

DebugHelper.WriteLog("current parameterset is: " + this.parameterSetName, 4);
DebugHelper.WriteLog("current parameterset is: " + this.ParameterSetName, 4);
}

/// <summary>
Expand Down Expand Up @@ -689,13 +605,6 @@ protected virtual void DisposeInternal()
/// </summary>
private readonly object myLock = new();

/// <summary>
/// <para>
/// parameter set name
/// </para>
/// </summary>
private string parameterSetName;

/// <summary>
/// This flag is introduced to resolve the parameter set name
/// during process record
Expand Down Expand Up @@ -747,13 +656,7 @@ internal CimAsyncOperation AsyncOperation
/// Get current ParameterSetName of the cmdlet
/// </para>
/// </summary>
internal string ParameterSetName
{
get
{
return this.parameterSetName;
}
}
internal string ParameterSetName { get; private set; }

/// <summary>
/// Gets/Sets cmdlet operation wrapper object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ internal CimGetCimClassContext(
string thePropertyName,
string theQualifierName)
{
this.className = theClassName;
this.methodName = theMethodName;
this.propertyName = thePropertyName;
this.qualifierName = theQualifierName;
this.ClassName = theClassName;
this.MethodName = theMethodName;
this.PropertyName = thePropertyName;
this.QualifierName = theQualifierName;
}

/// <summary>
Expand All @@ -44,14 +44,7 @@ internal CimGetCimClassContext(
/// Wildcard expansion should be allowed.
/// </para>
/// </summary>
public string ClassName
{
get { return className; }

set { className = value; }
}

private string className;
public string ClassName { get; set; }

/// <summary>
/// <para>
Expand All @@ -60,12 +53,7 @@ public string ClassName
/// Then Filter the <see cref="CimClass"/> by given methodname
/// </para>
/// </summary>
internal string MethodName
{
get { return methodName; }
}

private readonly string methodName;
internal string MethodName { get; }

/// <summary>
/// <para>
Expand All @@ -74,12 +62,7 @@ internal string MethodName
/// Filter the <see cref="CimClass"/> by given property name.
/// </para>
/// </summary>
internal string PropertyName
{
get { return propertyName; }
}

private readonly string propertyName;
internal string PropertyName { get; }

/// <summary>
/// <para>
Expand All @@ -88,12 +71,7 @@ internal string PropertyName
/// Filter the <see cref="CimClass"/> by given methodname
/// </para>
/// </summary>
internal string QualifierName
{
get { return qualifierName; }
}

private readonly string qualifierName;
internal string QualifierName { get; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@ public class CimIndicationEventExceptionEventArgs : CimIndicationEventArgs
/// Returns an exception
/// </para>
/// </summary>
public Exception Exception
{
get
{
return exception;
}
}

private readonly Exception exception;
public Exception Exception { get; }

/// <summary>
/// <para>
Expand All @@ -64,7 +56,7 @@ public Exception Exception
public CimIndicationEventExceptionEventArgs(Exception theException)
{
context = null;
this.exception = theException;
this.Exception = theException;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,20 @@ internal CimInvokeCimMethodContext(string theNamespace,
CimSessionProxy theProxy)
{
this.proxy = theProxy;
this.methodName = theMethodName;
this.collection = theCollection;
this.MethodName = theMethodName;
this.ParametersCollection = theCollection;
this.nameSpace = theNamespace;
}

/// <summary>
/// <para>namespace</para>
/// </summary>
internal string MethodName
{
get
{
return this.methodName;
}
}

private readonly string methodName;
internal string MethodName { get; }

/// <summary>
/// <para>parameters collection</para>
/// </summary>
internal CimMethodParametersCollection ParametersCollection
{
get
{
return this.collection;
}
}

private readonly CimMethodParametersCollection collection;
internal CimMethodParametersCollection ParametersCollection { get; }
}

/// <summary>
Expand Down
Loading