CommandBase.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using SuperSocket.SocketBase.Protocol;
  6. namespace SuperSocket.SocketBase.Command
  7. {
  8. /// <summary>
  9. /// Command base class
  10. /// </summary>
  11. /// <typeparam name="TAppSession">The type of the app session.</typeparam>
  12. /// <typeparam name="TRequestInfo">The type of the request info.</typeparam>
  13. public abstract class CommandBase<TAppSession, TRequestInfo> : ICommand<TAppSession, TRequestInfo>
  14. where TAppSession : IAppSession, IAppSession<TAppSession, TRequestInfo>, new()
  15. where TRequestInfo : IRequestInfo
  16. {
  17. #region ICommand<TAppSession,TRequestInfo> Members
  18. /// <summary>
  19. /// Executes the command.
  20. /// </summary>
  21. /// <param name="session">The session.</param>
  22. /// <param name="requestInfo">The request info.</param>
  23. public abstract void ExecuteCommand(TAppSession session, TRequestInfo requestInfo);
  24. #endregion
  25. #region ICommand Members
  26. /// <summary>
  27. /// Gets the name.
  28. /// </summary>
  29. public virtual string Name
  30. {
  31. get { return this.GetType().Name; }
  32. }
  33. #endregion
  34. /// <summary>
  35. /// Returns a <see cref="System.String" /> that represents this instance.
  36. /// </summary>
  37. /// <returns>
  38. /// A <see cref="System.String" /> that represents this instance.
  39. /// </returns>
  40. public override string ToString()
  41. {
  42. return this.GetType().AssemblyQualifiedName;
  43. }
  44. }
  45. }