@@ -12,18 +12,18 @@ namespace {{rootNamespace}}.{{domain.Name}}
1212    /// </summary >
1313    public class {{ dehumanize  domain.Name }} Adapter
1414    {
15-         private readonly IDevToolsSession m_session;
1615        private readonly string m_domainName = "{{ dehumanize  domain.Name }} ";
1716        private Dictionary<string , DevToolsEventData> m_eventMap = new Dictionary<string , DevToolsEventData>();
1817
1918        /// <summary >
2019        /// Initializes a new instance of the {{ dehumanize  domain.Name }} Adapter class.
2120        /// </summary >
2221        /// <param  name =" session"  >The IDevToolsSession to be used with this adapter.</param >
22+         /// <exception  cref =" ArgumentNullException"  >If <paramref  name =" session"  /> is <see  langword =" null"  />.</exception >
2323        public {{ dehumanize  domain.Name }} Adapter(IDevToolsSession session)
2424        {
25-             m_session  = session ?? throw new ArgumentNullException(nameof(session));
26-             m_session .DevToolsEventReceived += OnDevToolsEventReceived;
25+             Session  = session ?? throw new ArgumentNullException(nameof(session));
26+             Session .DevToolsEventReceived += OnDevToolsEventReceived;
2727    {{ #each  domain.Events }} 
2828            m_eventMap["{{ Name }} "] = new DevToolsEventData(typeof({{ dehumanize  Name }} EventArgs), On{{ dehumanize  Name }} );
2929    {{ /each }} 
@@ -32,16 +32,14 @@ namespace {{rootNamespace}}.{{domain.Name}}
3232        /// <summary >
3333        /// Gets the DevToolsSession associated with the adapter.
3434        /// </summary >
35-         public IDevToolsSession Session
36-         {
37-             get { return m_session; }
38-         }
35+         public IDevToolsSession Session { get; }
3936
4037    {{ #each  domain.Events }} 
4138        /// <summary >
4239        /// {{ xml-code-comment  Description   2 }} 
4340        /// </summary >
4441        public event EventHandler<{{dehumanize  Name}}EventArgs> {{ dehumanize  Name }} ;
42+ 
4543    {{ /each }} 
4644
4745    {{ #each  domain.Commands }} 
@@ -50,8 +48,9 @@ namespace {{rootNamespace}}.{{domain.Name}}
5048        /// </summary >
5149        public Task<{{dehumanize  Name}}CommandResponse> {{ dehumanize  Name }} ({{ dehumanize  Name }} CommandSettings command{{ #if  NoParameters }}  = null{{ /if }} , CancellationToken cancellationToken = default(CancellationToken), int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
5250        {
53-             return m_session .SendCommand<{{dehumanize  Name}}CommandSettings, {{ dehumanize  Name }} CommandResponse>(command{{ #if  NoParameters }}  ?? new {{ dehumanize  Name }} CommandSettings(){{ /if }} , cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived);
51+             return Session .SendCommand<{{dehumanize  Name}}CommandSettings, {{ dehumanize  Name }} CommandResponse>(command{{ #if  NoParameters }}  ?? new {{ dehumanize  Name }} CommandSettings(){{ /if }} , cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived);
5452        }
53+ 
5554    {{ /each }} 
5655
5756        private void OnDevToolsEventReceived(object sender, DevToolsEventReceivedEventArgs e)
@@ -70,12 +69,12 @@ namespace {{rootNamespace}}.{{domain.Name}}
7069    {{ #each  domain.Events }} 
7170        private void On{{ dehumanize  Name }} (object rawEventArgs)
7271        {
73-             {{ dehumanize  Name }} EventArgs e = rawEventArgs as {{ dehumanize  Name }} EventArgs;
74-             if (e != null &&  {{ dehumanize  Name }}  != null)
72+             if (rawEventArgs is {{ dehumanize  Name }} EventArgs e)
7573            {
76-                 {{ dehumanize  Name }} (this, e);
74+                 {{ dehumanize  Name }} ?.Invoke (this, e);
7775            }
7876        }
77+ 
7978    {{ /each }} 
8079    }
8180}
0 commit comments