RequiredFieldAttribute.cs 843 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. namespace SRF
  3. {
  4. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Field)]
  5. public sealed class RequiredFieldAttribute : Attribute
  6. {
  7. public RequiredFieldAttribute(bool autoSearch)
  8. {
  9. this.AutoSearch = autoSearch;
  10. }
  11. public RequiredFieldAttribute()
  12. {
  13. }
  14. public bool AutoSearch
  15. {
  16. get
  17. {
  18. return this._autoSearch;
  19. }
  20. set
  21. {
  22. this._autoSearch = value;
  23. }
  24. }
  25. public bool AutoCreate
  26. {
  27. get
  28. {
  29. return this._autoCreate;
  30. }
  31. set
  32. {
  33. this._autoCreate = value;
  34. }
  35. }
  36. [Obsolete]
  37. public bool EditorOnly
  38. {
  39. get
  40. {
  41. return this._editorOnly;
  42. }
  43. set
  44. {
  45. this._editorOnly = value;
  46. }
  47. }
  48. private bool _autoCreate;
  49. private bool _autoSearch;
  50. private bool _editorOnly = true;
  51. }
  52. }