Skip to content

Commit 0e0cd0b

Browse files
authored
1 parent e218234 commit 0e0cd0b

26 files changed

+292
-1002
lines changed

src/Microsoft.Management.Infrastructure.CimCmdlets/CimBaseAction.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,7 @@ public virtual void Execute(CmdletOperationBase cmdlet)
4444
/// <see cref="CimSession"/>, <see cref="CimOperationOptions"/> object.
4545
/// </para>
4646
/// </summary>
47-
protected XOperationContextBase Context
48-
{
49-
get
50-
{
51-
return this.context;
52-
}
53-
54-
set
55-
{
56-
this.context = value;
57-
}
58-
}
59-
60-
private XOperationContextBase context;
47+
protected XOperationContextBase Context { get; set; }
6148
}
6249

6350
/// <summary>

src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs

Lines changed: 21 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,19 @@ internal class ParameterDefinitionEntry
3131
/// <param name="mandatory"></param>
3232
internal ParameterDefinitionEntry(string parameterSetName, bool mandatory)
3333
{
34-
this.mandatory = mandatory;
35-
this.parameterSetName = parameterSetName;
34+
this.IsMandatory = mandatory;
35+
this.ParameterSetName = parameterSetName;
3636
}
3737

3838
/// <summary>
3939
/// Property ParameterSetName.
4040
/// </summary>
41-
internal string ParameterSetName
42-
{
43-
get
44-
{
45-
return this.parameterSetName;
46-
}
47-
}
48-
49-
private readonly string parameterSetName = null;
41+
internal string ParameterSetName { get; } = null;
5042

5143
/// <summary>
5244
/// Whether the parameter is mandatory to the set.
5345
/// </summary>
54-
internal bool IsMandatory
55-
{
56-
get
57-
{
58-
return this.mandatory;
59-
}
60-
}
61-
62-
private readonly bool mandatory = false;
46+
internal bool IsMandatory { get; } = false;
6347
}
6448

6549
/// <summary>
@@ -75,8 +59,8 @@ internal class ParameterSetEntry
7559
/// <param name="mandatoryParameterCount"></param>
7660
internal ParameterSetEntry(UInt32 mandatoryParameterCount)
7761
{
78-
this.mandatoryParameterCount = mandatoryParameterCount;
79-
this.isDefaultParameterSet = false;
62+
this.MandatoryParameterCount = mandatoryParameterCount;
63+
this.IsDefaultParameterSet = false;
8064
reset();
8165
}
8266

@@ -86,8 +70,8 @@ internal ParameterSetEntry(UInt32 mandatoryParameterCount)
8670
/// <param name="toClone"></param>
8771
internal ParameterSetEntry(ParameterSetEntry toClone)
8872
{
89-
this.mandatoryParameterCount = toClone.MandatoryParameterCount;
90-
this.isDefaultParameterSet = toClone.IsDefaultParameterSet;
73+
this.MandatoryParameterCount = toClone.MandatoryParameterCount;
74+
this.IsDefaultParameterSet = toClone.IsDefaultParameterSet;
9175
reset();
9276
}
9377

@@ -98,8 +82,8 @@ internal ParameterSetEntry(ParameterSetEntry toClone)
9882
/// <param name="mandatory"></param>
9983
internal ParameterSetEntry(UInt32 mandatoryParameterCount, bool isDefault)
10084
{
101-
this.mandatoryParameterCount = mandatoryParameterCount;
102-
this.isDefaultParameterSet = isDefault;
85+
this.MandatoryParameterCount = mandatoryParameterCount;
86+
this.IsDefaultParameterSet = isDefault;
10387
reset();
10488
}
10589

@@ -108,107 +92,39 @@ internal ParameterSetEntry(UInt32 mandatoryParameterCount, bool isDefault)
10892
/// </summary>
10993
internal void reset()
11094
{
111-
this.setMandatoryParameterCount = this.setMandatoryParameterCountAtBeginProcess;
112-
this.isValueSet = this.isValueSetAtBeginProcess;
95+
this.SetMandatoryParameterCount = this.SetMandatoryParameterCountAtBeginProcess;
96+
this.IsValueSet = this.IsValueSetAtBeginProcess;
11397
}
11498

11599
/// <summary>
116100
/// Property <c>DefaultParameterSet</c>
117101
/// </summary>
118-
internal bool IsDefaultParameterSet
119-
{
120-
get
121-
{
122-
return this.isDefaultParameterSet;
123-
}
124-
}
125-
126-
private readonly bool isDefaultParameterSet = false;
102+
internal bool IsDefaultParameterSet { get; } = false;
127103

128104
/// <summary>
129105
/// Property <c>MandatoryParameterCount</c>
130106
/// </summary>
131-
internal UInt32 MandatoryParameterCount
132-
{
133-
get
134-
{
135-
return this.mandatoryParameterCount;
136-
}
137-
}
138-
139-
private readonly UInt32 mandatoryParameterCount = 0;
107+
internal UInt32 MandatoryParameterCount { get; } = 0;
140108

141109
/// <summary>
142110
/// Property <c>IsValueSet</c>
143111
/// </summary>
144-
internal bool IsValueSet
145-
{
146-
get
147-
{
148-
return this.isValueSet;
149-
}
150-
151-
set
152-
{
153-
this.isValueSet = value;
154-
}
155-
}
156-
157-
private bool isValueSet = false;
112+
internal bool IsValueSet { get; set; } = false;
158113

159114
/// <summary>
160115
/// Property <c>IsValueSetAtBeginProcess</c>
161116
/// </summary>
162-
internal bool IsValueSetAtBeginProcess
163-
{
164-
get
165-
{
166-
return this.isValueSetAtBeginProcess;
167-
}
168-
169-
set
170-
{
171-
this.isValueSetAtBeginProcess = value;
172-
}
173-
}
174-
175-
private bool isValueSetAtBeginProcess = false;
117+
internal bool IsValueSetAtBeginProcess { get; set; } = false;
176118

177119
/// <summary>
178120
/// Property <c>SetMandatoryParameterCount</c>
179121
/// </summary>
180-
internal UInt32 SetMandatoryParameterCount
181-
{
182-
get
183-
{
184-
return this.setMandatoryParameterCount;
185-
}
186-
187-
set
188-
{
189-
this.setMandatoryParameterCount = value;
190-
}
191-
}
192-
193-
private UInt32 setMandatoryParameterCount = 0;
122+
internal UInt32 SetMandatoryParameterCount { get; set; } = 0;
194123

195124
/// <summary>
196125
/// Property <c>SetMandatoryParameterCountAtBeginProcess</c>
197126
/// </summary>
198-
internal UInt32 SetMandatoryParameterCountAtBeginProcess
199-
{
200-
get
201-
{
202-
return this.setMandatoryParameterCountAtBeginProcess;
203-
}
204-
205-
set
206-
{
207-
this.setMandatoryParameterCountAtBeginProcess = value;
208-
}
209-
}
210-
211-
private UInt32 setMandatoryParameterCountAtBeginProcess = 0;
127+
internal UInt32 SetMandatoryParameterCountAtBeginProcess { get; set; } = 0;
212128
}
213129

214130
/// <summary>
@@ -531,15 +447,15 @@ internal void CheckParameterSet()
531447
{
532448
try
533449
{
534-
this.parameterSetName = this.parameterBinder.GetParameterSet();
450+
this.ParameterSetName = this.parameterBinder.GetParameterSet();
535451
}
536452
finally
537453
{
538454
this.parameterBinder.reset();
539455
}
540456
}
541457

542-
DebugHelper.WriteLog("current parameterset is: " + this.parameterSetName, 4);
458+
DebugHelper.WriteLog("current parameterset is: " + this.ParameterSetName, 4);
543459
}
544460

545461
/// <summary>
@@ -689,13 +605,6 @@ protected virtual void DisposeInternal()
689605
/// </summary>
690606
private readonly object myLock = new();
691607

692-
/// <summary>
693-
/// <para>
694-
/// parameter set name
695-
/// </para>
696-
/// </summary>
697-
private string parameterSetName;
698-
699608
/// <summary>
700609
/// This flag is introduced to resolve the parameter set name
701610
/// during process record
@@ -747,13 +656,7 @@ internal CimAsyncOperation AsyncOperation
747656
/// Get current ParameterSetName of the cmdlet
748657
/// </para>
749658
/// </summary>
750-
internal string ParameterSetName
751-
{
752-
get
753-
{
754-
return this.parameterSetName;
755-
}
756-
}
659+
internal string ParameterSetName { get; private set; }
757660

758661
/// <summary>
759662
/// Gets/Sets cmdlet operation wrapper object.

src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetCimClass.cs

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ internal CimGetCimClassContext(
3030
string thePropertyName,
3131
string theQualifierName)
3232
{
33-
this.className = theClassName;
34-
this.methodName = theMethodName;
35-
this.propertyName = thePropertyName;
36-
this.qualifierName = theQualifierName;
33+
this.ClassName = theClassName;
34+
this.MethodName = theMethodName;
35+
this.PropertyName = thePropertyName;
36+
this.QualifierName = theQualifierName;
3737
}
3838

3939
/// <summary>
@@ -44,14 +44,7 @@ internal CimGetCimClassContext(
4444
/// Wildcard expansion should be allowed.
4545
/// </para>
4646
/// </summary>
47-
public string ClassName
48-
{
49-
get { return className; }
50-
51-
set { className = value; }
52-
}
53-
54-
private string className;
47+
public string ClassName { get; set; }
5548

5649
/// <summary>
5750
/// <para>
@@ -60,12 +53,7 @@ public string ClassName
6053
/// Then Filter the <see cref="CimClass"/> by given methodname
6154
/// </para>
6255
/// </summary>
63-
internal string MethodName
64-
{
65-
get { return methodName; }
66-
}
67-
68-
private readonly string methodName;
56+
internal string MethodName { get; }
6957

7058
/// <summary>
7159
/// <para>
@@ -74,12 +62,7 @@ internal string MethodName
7462
/// Filter the <see cref="CimClass"/> by given property name.
7563
/// </para>
7664
/// </summary>
77-
internal string PropertyName
78-
{
79-
get { return propertyName; }
80-
}
81-
82-
private readonly string propertyName;
65+
internal string PropertyName { get; }
8366

8467
/// <summary>
8568
/// <para>
@@ -88,12 +71,7 @@ internal string PropertyName
8871
/// Filter the <see cref="CimClass"/> by given methodname
8972
/// </para>
9073
/// </summary>
91-
internal string QualifierName
92-
{
93-
get { return qualifierName; }
94-
}
95-
96-
private readonly string qualifierName;
74+
internal string QualifierName { get; }
9775
}
9876

9977
/// <summary>

src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,7 @@ public class CimIndicationEventExceptionEventArgs : CimIndicationEventArgs
4545
/// Returns an exception
4646
/// </para>
4747
/// </summary>
48-
public Exception Exception
49-
{
50-
get
51-
{
52-
return exception;
53-
}
54-
}
55-
56-
private readonly Exception exception;
48+
public Exception Exception { get; }
5749

5850
/// <summary>
5951
/// <para>
@@ -64,7 +56,7 @@ public Exception Exception
6456
public CimIndicationEventExceptionEventArgs(Exception theException)
6557
{
6658
context = null;
67-
this.exception = theException;
59+
this.Exception = theException;
6860
}
6961
}
7062

src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,20 @@ internal CimInvokeCimMethodContext(string theNamespace,
4040
CimSessionProxy theProxy)
4141
{
4242
this.proxy = theProxy;
43-
this.methodName = theMethodName;
44-
this.collection = theCollection;
43+
this.MethodName = theMethodName;
44+
this.ParametersCollection = theCollection;
4545
this.nameSpace = theNamespace;
4646
}
4747

4848
/// <summary>
4949
/// <para>namespace</para>
5050
/// </summary>
51-
internal string MethodName
52-
{
53-
get
54-
{
55-
return this.methodName;
56-
}
57-
}
58-
59-
private readonly string methodName;
51+
internal string MethodName { get; }
6052

6153
/// <summary>
6254
/// <para>parameters collection</para>
6355
/// </summary>
64-
internal CimMethodParametersCollection ParametersCollection
65-
{
66-
get
67-
{
68-
return this.collection;
69-
}
70-
}
71-
72-
private readonly CimMethodParametersCollection collection;
56+
internal CimMethodParametersCollection ParametersCollection { get; }
7357
}
7458

7559
/// <summary>

0 commit comments

Comments
 (0)