ProviderFactoryInfo.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace SuperSocket.SocketBase.Provider
  6. {
  7. /// <summary>
  8. /// Provider factory infomation
  9. /// </summary>
  10. [Serializable]
  11. public class ProviderFactoryInfo
  12. {
  13. /// <summary>
  14. /// Gets the key.
  15. /// </summary>
  16. public ProviderKey Key { get; set; }
  17. /// <summary>
  18. /// Gets or sets the name.
  19. /// </summary>
  20. /// <value>
  21. /// The name.
  22. /// </value>
  23. public string Name { get; set; }
  24. /// <summary>
  25. /// Gets or sets the export factory.
  26. /// </summary>
  27. /// <value>
  28. /// The export factory.
  29. /// </value>
  30. public ExportFactory ExportFactory { get; set; }
  31. /// <summary>
  32. /// Initializes a new instance of the <see cref="ProviderFactoryInfo"/> class.
  33. /// </summary>
  34. public ProviderFactoryInfo()
  35. {
  36. }
  37. /// <summary>
  38. /// Initializes a new instance of the <see cref="ProviderFactoryInfo"/> class.
  39. /// </summary>
  40. /// <param name="key">The key.</param>
  41. /// <param name="name">The name.</param>
  42. /// <param name="instance">The instance.</param>
  43. public ProviderFactoryInfo(ProviderKey key, string name, object instance)
  44. {
  45. Key = key;
  46. Name = name;
  47. ExportFactory = new ExportFactory(instance);
  48. }
  49. /// <summary>
  50. /// Initializes a new instance of the <see cref="ProviderFactoryInfo"/> class.
  51. /// </summary>
  52. /// <param name="key">The key.</param>
  53. /// <param name="name">The name.</param>
  54. /// <param name="typeName">Name of the type.</param>
  55. public ProviderFactoryInfo(ProviderKey key, string name, string typeName)
  56. {
  57. Key = key;
  58. Name = name;
  59. ExportFactory = new ExportFactory(typeName);
  60. }
  61. /// <summary>
  62. /// Initializes a new instance of the <see cref="ProviderFactoryInfo"/> class.
  63. /// </summary>
  64. /// <param name="key">The key.</param>
  65. /// <param name="name">The name.</param>
  66. /// <param name="type">The type.</param>
  67. public ProviderFactoryInfo(ProviderKey key, string name, Type type)
  68. : this(key, name, type.AssemblyQualifiedName)
  69. {
  70. }
  71. }
  72. }