/src/DbLinq/Data/Linq/Sql/SqlLiteralPart.cs

http://dblinq2007.googlecode.com/ · C# · 70 lines · 23 code · 5 blank · 42 comment · 0 complexity · 2b3dfc3c7554a77a33dc2bb0a839474a MD5 · raw file

  1. #region MIT license
  2. //
  3. // MIT license
  4. //
  5. // Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. //
  25. #endregion
  26. using System.Diagnostics;
  27. namespace DbLinq.Data.Linq.Sql
  28. {
  29. /// <summary>
  30. /// Represents a literal SQL part
  31. /// </summary>
  32. [DebuggerDisplay("SqlLiteralPart {Literal}")]
  33. #if !MONO_STRICT
  34. public
  35. #endif
  36. class SqlLiteralPart : SqlPart
  37. {
  38. /// <summary>
  39. /// The resulting SQL string
  40. /// </summary>
  41. /// <value></value>
  42. public override string Sql { get { return Literal; } }
  43. /// <summary>
  44. /// Literal SQL used as is
  45. /// </summary>
  46. public string Literal { get; private set; }
  47. /// <summary>
  48. /// Initializes a new instance of the <see cref="SqlLiteralPart"/> class.
  49. /// </summary>
  50. /// <param name="literal">The literal.</param>
  51. public SqlLiteralPart(string literal)
  52. {
  53. Literal = literal;
  54. }
  55. /// <summary>
  56. /// Creates a SqlLiteralPart from a given string (implicit)
  57. /// </summary>
  58. /// <param name="literal"></param>
  59. /// <returns></returns>
  60. public static implicit operator SqlLiteralPart(string literal)
  61. {
  62. return new SqlLiteralPart(literal);
  63. }
  64. }
  65. }