本文整理汇总了C#中BsonType类的典型用法代码示例。如果您正苦于以下问题:C# BsonType类的具体用法?C# BsonType怎么用?C# BsonType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BsonType类属于命名空间,在下文中一共展示了BsonType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:redforks,项目名称:mongo-csharp-driver,代码行数:12,代码来源:DateTimeSerializationOptions.cs
示例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;
}
}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:33,代码来源:Application.cs
示例3: CollectionProperty
public CollectionProperty(string name, BsonType type, string fullName)
{
_name = name;
_type = type;
_fullName = fullName;
Children = new Dictionary<string, CollectionProperty>();
}
开发者ID:stevehjohn,项目名称:Hub,代码行数:7,代码来源:CollectionPropertyAnalyser.cs
示例4: Find
public static IBehavior Find(BsonType bsonType)
{
IBehavior behavior;
return DsonBehaviors.TryGetValue(bsonType, out behavior)
? behavior
: null;
}
开发者ID:raymondyong,项目名称:DynamicBson,代码行数:8,代码来源:BehaviorLookup.cs
示例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;
}
开发者ID:redforks,项目名称:mongo-csharp-driver,代码行数:15,代码来源:RepresentationSerializationOptions.cs
示例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;
}
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:10,代码来源:JsonReaderBookmark.cs
示例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;
}
开发者ID:labeuze,项目名称:source,代码行数:10,代码来源:PBBsonReaderWithBookmark.cs
示例8: BsonReaderBookmark
protected BsonReaderBookmark(
BsonReadState state,
BsonType currentBsonType,
string currentName
)
{
this.state = state;
this.currentBsonType = currentBsonType;
this.currentName = currentName;
}
开发者ID:kolupaev,项目名称:mongo-csharp-driver,代码行数:10,代码来源:BsonReaderBookmark.cs
示例9: BsonDocumentReaderBookmark
internal BsonDocumentReaderBookmark(
BsonDocumentReaderContext context,
BsonReadState state,
BsonType currentBsonType
)
{
this.context = context.Clone();
this.state = state;
this.currentBsonType = currentBsonType;
}
开发者ID:swiggin1,项目名称:mongo-csharp-driver,代码行数:10,代码来源:BsonDocumentReaderBookmark.cs
示例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;
}
开发者ID:kenegozi,项目名称:mongo-csharp-driver,代码行数:11,代码来源:BsonBinaryReader.cs
示例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;
}
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:17,代码来源:EnumRepresentationConvention.cs
示例12: BsonDocumentReaderBookmark
// constructors
internal BsonDocumentReaderBookmark(
BsonReaderState state,
BsonType currentBsonType,
string currentName,
BsonDocumentReaderContext context,
BsonValue currentValue)
: base(state, currentBsonType, currentName)
{
_context = context.Clone();
_currentValue = currentValue;
}
开发者ID:horizon3d,项目名称:SequoiaDB,代码行数:12,代码来源:BsonDocumentReaderBookmark.cs
示例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);
}
开发者ID:Bogdan0x400,项目名称:mongo-csharp-driver,代码行数:11,代码来源:EnumRepresentationConventionTests.cs
示例14: BsonBinaryReaderBookmark
// constructors
internal BsonBinaryReaderBookmark(
BsonReaderState state,
BsonType currentBsonType,
string currentName,
BsonBinaryReaderContext context,
int position)
: base(state, currentBsonType, currentName)
{
_context = context.Clone();
_position = position;
}
开发者ID:CloudMetal,项目名称:mongo-csharp-driver,代码行数:12,代码来源:BsonBinaryReaderBookmark.cs
示例15: BsonBinaryReaderBookmark
internal BsonBinaryReaderBookmark(
BsonBinaryReaderContext context,
BsonReadState state,
BsonType currentBsonType,
int position
)
{
this.context = context;
this.state = state;
this.currentBsonType = currentBsonType;
this.position = position;
}
开发者ID:swiggin1,项目名称:mongo-csharp-driver,代码行数:12,代码来源:BsonBinaryReaderBookmark.cs
示例16: 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.IsNull(nonEnumMemberMap.SerializationOptions);
Assert.IsNull(defaultEnumMemberMap.SerializationOptions);
Assert.AreEqual(value, ((RepresentationSerializationOptions)changedEnumMemberMap.SerializationOptions).Representation);
}
开发者ID:niemyjski,项目名称:mongo-csharp-driver,代码行数:13,代码来源:EnumRepresentationConventionTests.cs
示例17: CalculateSize
public int CalculateSize(BsonType t_Type, List<object> value)
{
//TestSwitchForEach.BsonBinaryWriter <0000> nop
//TestSwitchForEach.BsonBinaryWriter <004a> nop
//TestSwitchForEach.BsonBinaryWriter <0053> br.s, to be optimized away
//enter finally { mname = <0053> br.s, to be optimized away.try }
//TestSwitchForEach.BsonBinaryWriter <006b> ldloca.s
//enter finally { mname = <006b> ldloca.s.try }
//TestSwitchForEach.BsonBinaryWriter <0055> ldloca.s
//{ p = { x = 1 } }
//enter finally { mname = <0055> ldloca.s.try }
//TestSwitchForEach.BsonBinaryWriter <006b> ldloca.s
//enter finally { mname = <006b> ldloca.s.try }
//TestSwitchForEach.BsonBinaryWriter <0055> ldloca.s
//{ p = { x = 2 } }
//enter finally { mname = <0055> ldloca.s.try }
//TestSwitchForEach.BsonBinaryWriter <006b> ldloca.s
//enter finally { mname = <006b> ldloca.s.try }
//TestSwitchForEach.BsonBinaryWriter <0078> leave.s, to be optimized away
//enter finally { mname = <0078> leave.s, to be optimized away.try }
//TestSwitchForEach.BsonBinaryWriter <0089> nop
//TestSwitchForEach.BsonBinaryWriter <00ab> ldloc.1
switch (t_Type)
{
case BsonType.Object:
{
foreach (var p in value)
{
Console.WriteLine(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;
}
}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:51,代码来源:Program.cs
示例18: WriteEscapedJavaScriptString
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201405/20140524
//public static int WriteEscapedJavaScriptString(BsonType t_Type, ref char[] writeBuffer)
//public static int WriteEscapedJavaScriptString(BsonType t_Type, char[] writeBuffer)
public int WriteEscapedJavaScriptString(
BsonType t_Type,
char[] writeBuffer,
// why is this not made byref?
foo foo)
{
foo foocopy = foo;
// X:\jsc.svn\examples\rewrite\Test\TestSwitchForEach\TestSwitchForEach\Program.cs
switch (t_Type)
{
case BsonType.Object:
{
//foreach (var p in writeBuffer)
foreach (var p in foo.writeBuffer)
{
Console.WriteLine(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;
}
}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:46,代码来源:Program.cs
示例19: VerifyBsonType
/// <summary>
/// Verifies the current state and BsonType of the reader.
/// </summary>
/// <param name="methodName">The name of the method calling this one.</param>
/// <param name="requiredBsonType">The required BSON type.</param>
protected void VerifyBsonType(string methodName, BsonType requiredBsonType)
{
if (_state == BsonReaderState.Initial || _state == BsonReaderState.ScopeDocument || _state == BsonReaderState.Type)
{
ReadBsonType();
}
if (_state == BsonReaderState.Name)
{
// ignore name
SkipName();
}
if (_state != BsonReaderState.Value)
{
ThrowInvalidState(methodName, BsonReaderState.Value);
}
if (_currentBsonType != requiredBsonType)
{
var message = string.Format(
"{0} can only be called when CurrentBsonType is {1}, not when CurrentBsonType is {2}.",
methodName, requiredBsonType, _currentBsonType);
throw new InvalidOperationException(message);
}
}
开发者ID:joeenzminger,项目名称:mongo-csharp-driver,代码行数:28,代码来源:BsonReader.cs
示例20: AddValue
private void AddValue(object value, BsonType type)
{
AddToken(new BsonValue(value, type));
}
开发者ID:Houfeng,项目名称:AjaxEngine,代码行数:4,代码来源:BsonWriter.cs
注:本文中的BsonType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论