提交 e59cd1c0 编写于 作者: T tanghai

Mongodb库更新

上级 c4d5d855
......@@ -30,19 +30,22 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.Xml" />
<Reference Include="MongoDB.Bson">
<HintPath>..\..\packages\mongocsharpdriver.1.10.0-rc1\lib\net35\MongoDB.Bson.dll</HintPath>
<Reference Include="MongoDB.Bson, Version=1.10.0.52, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\mongocsharpdriver.1.10.0\lib\net35\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="NLog">
<Reference Include="NLog, Version=3.2.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\NLog.3.2.0.0\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="protobuf-net">
<Reference Include="protobuf-net, Version=2.0.0.668, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Base\Component.cs" />
......
......@@ -8,16 +8,16 @@ namespace Common.Helper
{
public static byte[] ToBytes<T>(T message)
{
var ms = new MemoryStream();
MemoryStream ms = new MemoryStream();
Serializer.Serialize(ms, message);
return ms.ToArray();
}
public static T FromBytes<T>(byte[] bytes)
{
var ms = new MemoryStream(bytes, 0, bytes.Length);
MemoryStream ms = new MemoryStream(bytes, 0, bytes.Length);
T t = Serializer.Deserialize<T>(ms);
var iSupportInitialize = t as ISupportInitialize;
ISupportInitialize iSupportInitialize = t as ISupportInitialize;
if (iSupportInitialize == null)
{
return t;
......@@ -28,9 +28,9 @@ namespace Common.Helper
public static T FromBytes<T>(byte[] bytes, int index, int length)
{
var ms = new MemoryStream(bytes, index, length);
MemoryStream ms = new MemoryStream(bytes, index, length);
T t = Serializer.Deserialize<T>(ms);
var iSupportInitialize = t as ISupportInitialize;
ISupportInitialize iSupportInitialize = t as ISupportInitialize;
if (iSupportInitialize == null)
{
return t;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册