本文整理汇总了C#中BsonType类的典型用法代码示例。如果您正苦于以下问题:C# BsonType类的具体用法?C# BsonType怎么用?C# BsonType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BsonType类属于命名空间,在下文中一共展示了BsonType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DateTimeSerializationOptions
/// <summary>
/// Initializes a new instance of the DateTimeSerializationOptions class.
/// </summary>
/// <param name="kind">The DateTimeKind (Local, Unspecified or Utc).</param>
/// <param name="representation">The external representation.</param>
public DateTimeSerializationOptions(
DateTimeKind kind,
BsonType representation
) {
this.kind = kind;
this.representation = representation;
}
示例2: CalculateSize
public int CalculateSize(BsonType t_Type, List<object> value)
{
switch (t_Type)
{
case BsonType.Object:
{
foreach (var p in value)
{
//Console.WriteLine(new { p });
Native.document.body += new IHTMLPre { new { p } };
}
return -1;
}
case BsonType.Integer:
return 4;
case BsonType.Long:
return 8;
case BsonType.Number:
return 8;
case BsonType.Boolean:
return 1;
case BsonType.Null:
case BsonType.Undefined:
return 0;
case BsonType.Date:
return 8;
default:
return 12;
}
}
示例3: CollectionProperty
public CollectionProperty(string name, BsonType type, string fullName)
{
_name = name;
_type = type;
_fullName = fullName;
Children = new Dictionary<string, CollectionProperty>();
}
示例4: Find
public static IBehavior Find(BsonType bsonType)
{
IBehavior behavior;
return DsonBehaviors.TryGetValue(bsonType, out behavior)
? behavior
: null;
}
示例5: RepresentationSerializationOptions
/// <summary>
/// Initializes a new instance of the RepresentationSerializationOptions class.
/// </summary>
/// <param name="representation">The external representation.</param>
/// <param name="allowOverflow">Whether to allow overflow.</param>
/// <param name="allowTruncation">Whether to allow truncation.</param>
public RepresentationSerializationOptions(
BsonType representation,
bool allowOverflow,
bool allowTruncation
) {
this.representation = representation;
this.allowOverflow = allowOverflow;
this.allowTruncation = allowTruncation;
}
示例6: JsonReaderBookmark
// constructors
internal JsonReaderBookmark(BsonReaderState state, BsonType currentBsonType, string currentName, JsonReaderContext context, JsonToken currentToken, BsonValue currentValue, JsonToken pushedToken, int position)
: base(state, currentBsonType, currentName)
{
_context = context.Clone();
_currentToken = currentToken;
_currentValue = currentValue;
_pushedToken = pushedToken;
_position = position;
}
示例7: ReturnToBookmark
public void ReturnToBookmark(PBBsonReaderBookmark bookmark)
{
_reader.ReturnToBookmark(bookmark.Bookmark);
_type = bookmark.Type;
_name = bookmark.Name;
_bsonType = bookmark.BsonType;
_value = bookmark.Value;
_indent = bookmark.Indent;
_indentString = bookmark.IndentString;
}
示例8: BsonReaderBookmark
protected BsonReaderBookmark(
BsonReadState state,
BsonType currentBsonType,
string currentName
)
{
this.state = state;
this.currentBsonType = currentBsonType;
this.currentName = currentName;
}
示例9: BsonDocumentReaderBookmark
internal BsonDocumentReaderBookmark(
BsonDocumentReaderContext context,
BsonReadState state,
BsonType currentBsonType
)
{
this.context = context.Clone();
this.state = state;
this.currentBsonType = currentBsonType;
}
示例10: BsonBinaryReader
public BsonBinaryReader(
BsonBuffer buffer,
BsonBinaryReaderSettings settings
) {
this.buffer = buffer ?? new BsonBuffer();
this.disposeBuffer = buffer == null; // only call Dispose if we allocated the buffer
this.settings = settings;
context = null;
state = BsonReadState.Initial;
currentBsonType = BsonType.Document;
}
示例11: EnumRepresentationConvention
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="EnumRepresentationConvention" /> class.
/// </summary>
/// <param name="representation">The serialization representation. 0 is used to detect representation
/// from the enum itself.</param>
public EnumRepresentationConvention(BsonType representation)
{
if (!((representation == 0) ||
(representation == BsonType.String) ||
(representation == BsonType.Int32) ||
(representation == BsonType.Int64)))
{
throw new ArgumentException("Enums can only be represented as String, Int32, Int64 or the type of the enum");
}
_representation = representation;
}
示例12: BsonDocumentReaderBookmark
// constructors
internal BsonDocumentReaderBookmark(
BsonReaderState state,
BsonType currentBsonType,
string currentName,
BsonDocumentReaderContext context,
BsonValue currentValue)
: base(state, currentBsonType, currentName)
{
_context = context.Clone();
_currentValue = currentValue;
}
示例13: TestConvention
public void TestConvention(BsonType value)
{
var convention = new EnumRepresentationConvention(value);
var classMap = new BsonClassMap<TestClass>();
var nonEnumMemberMap = classMap.MapMember(x => x.NonEnum);
var defaultEnumMemberMap = classMap.MapMember(x => x.DefaultEnum);
var changedEnumMemberMap = classMap.MapMember(x => x.ChangedRepresentationEnum);
convention.Apply(nonEnumMemberMap);
convention.Apply(changedEnumMemberMap);
Assert.AreEqual(value, ((IRepresentationConfigurable)(changedEnumMemberMap.GetSerializer())).Representation);
}
示例14: BsonBinaryReaderBookmark
// constructors
internal BsonBinaryReaderBookmark(
BsonReaderState state,
BsonType currentBsonType,
string currentName,
BsonBinaryReaderContext context,
int position)
: base(state, currentBsonType, currentName)
{
_context = context.Clone();
_position = position;
}
示例15: BsonBinaryReaderBookmark
internal BsonBinaryReaderBookmark(
BsonBinaryReaderContext context,
BsonReadState state,
BsonType currentBsonType,
int position
)
{
this.context = context;
this.state = state;
this.currentBsonType = currentBsonType;
this.position = position;
}