forked from samus/mongodb-csharp
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the possibility to create mapped classes from a protected constru…
…ctor but not from a private one.
- Loading branch information
Showing
7 changed files
with
185 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,70 @@ | ||
using System; | ||
|
||
namespace MongoDB | ||
|
||
namespace MongoDB | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public class Binary{ | ||
public class Binary | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public enum TypeCode:byte{ | ||
public enum TypeCode : byte | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
Unknown = 0, | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
General = 2, | ||
// Uuid = 3 is now replaced by Guid | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
Md5 = 5, | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
UserDefined = 80 | ||
UserDefined = 80 | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the bytes. | ||
/// Initializes a new instance of the <see cref = "Binary" /> class. | ||
/// </summary> | ||
/// <value>The bytes.</value> | ||
public byte[] Bytes{get;set;} | ||
public Binary() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the subtype. | ||
/// Initializes a new instance of the <see cref = "Binary" /> class. | ||
/// </summary> | ||
/// <value>The subtype.</value> | ||
public TypeCode Subtype{get;set;} | ||
/// <param name = "bytes">The value.</param> | ||
public Binary(byte[] bytes) | ||
{ | ||
Bytes = bytes; | ||
Subtype = TypeCode.General; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Binary"/> class. | ||
/// Gets or sets the bytes. | ||
/// </summary> | ||
public Binary() { } | ||
/// <value>The bytes.</value> | ||
public byte[] Bytes { get; set; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Binary"/> class. | ||
/// Gets or sets the subtype. | ||
/// </summary> | ||
/// <param name="value">The value.</param> | ||
public Binary(byte[] value){ | ||
Bytes = value; | ||
Subtype = TypeCode.General; | ||
} | ||
/// <value>The subtype.</value> | ||
public TypeCode Subtype { get; set; } | ||
|
||
/// <summary> | ||
/// Returns a <see cref="System.String"/> that represents this instance. | ||
/// Returns a <see cref = "System.String" /> that represents this instance. | ||
/// </summary> | ||
/// <returns> | ||
/// A <see cref="System.String"/> that represents this instance. | ||
/// A <see cref = "System.String" /> that represents this instance. | ||
/// </returns> | ||
public override string ToString (){ | ||
public override string ToString() | ||
{ | ||
return String.Format(@"{{ ""$binary"": ""{0}"", ""$type"" : {1} }}", | ||
Convert.ToBase64String(Bytes), | ||
(int)Subtype); | ||
} | ||
} | ||
} | ||
(int)Subtype); | ||
} | ||
} | ||
} |
Oops, something went wrong.