Skip to content

Commit f3be648

Browse files
committed
moved class to it's own file to appease the mono compiler.
1 parent 0d19f21 commit f3be648

File tree

3 files changed

+58
-36
lines changed

3 files changed

+58
-36
lines changed

src/MongoDB.Driver.GridFS/GridFSFileInfo.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -165,40 +165,4 @@ public DateTime UploadDateTime
165165
get { return GetValue<DateTime>("UploadDateTime"); }
166166
}
167167
}
168-
169-
/// <summary>
170-
/// Represents a serializer for GridFSFileInfo.
171-
/// </summary>
172-
public class GridFSFileInfoSerializer : BsonDocumentBackedClassSerializer<GridFSFileInfo>
173-
{
174-
#region static
175-
// public static properties
176-
/// <summary>
177-
/// Gets the pre-created instance.
178-
/// </summary>
179-
/// <value>
180-
/// The pre-created instance.
181-
/// </value>
182-
public static GridFSFileInfoSerializer Instance { get; } = new GridFSFileInfoSerializer();
183-
#endregion
184-
185-
private GridFSFileInfoSerializer()
186-
{
187-
RegisterMember("Aliases", "aliases", new ArraySerializer<string>());
188-
RegisterMember("ChunkSizeBytes", "chunkSize", new Int32Serializer());
189-
RegisterMember("ContentType", "contentType", new StringSerializer());
190-
RegisterMember("Filename", "filename", new StringSerializer());
191-
RegisterMember("IdAsBsonValue", "_id", BsonValueSerializer.Instance);
192-
RegisterMember("Length", "length", new Int64Serializer());
193-
RegisterMember("MD5", "md5", new StringSerializer());
194-
RegisterMember("Metadata", "metadata", BsonDocumentSerializer.Instance);
195-
RegisterMember("UploadDateTime", "uploadDate", new DateTimeSerializer());
196-
}
197-
198-
/// <inheritdoc/>
199-
protected override GridFSFileInfo CreateInstance(BsonDocument backingDocument)
200-
{
201-
return new GridFSFileInfo(backingDocument);
202-
}
203-
}
204168
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* Copyright 2015 MongoDB Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
using MongoDB.Bson;
17+
using MongoDB.Bson.Serialization;
18+
using MongoDB.Bson.Serialization.Serializers;
19+
20+
namespace MongoDB.Driver.GridFS
21+
{
22+
/// <summary>
23+
/// Represents a serializer for GridFSFileInfo.
24+
/// </summary>
25+
public class GridFSFileInfoSerializer : BsonDocumentBackedClassSerializer<GridFSFileInfo>
26+
{
27+
/// <summary>
28+
/// Gets the pre-created instance.
29+
/// </summary>
30+
/// <value>
31+
/// The pre-created instance.
32+
/// </value>
33+
public static GridFSFileInfoSerializer Instance { get; } = new GridFSFileInfoSerializer();
34+
35+
/// <summary>
36+
/// Initializes a new instance of the <see cref="GridFSFileInfoSerializer" /> class.
37+
/// </summary>
38+
public GridFSFileInfoSerializer()
39+
{
40+
RegisterMember("Aliases", "aliases", new ArraySerializer<string>());
41+
RegisterMember("ChunkSizeBytes", "chunkSize", new Int32Serializer());
42+
RegisterMember("ContentType", "contentType", new StringSerializer());
43+
RegisterMember("Filename", "filename", new StringSerializer());
44+
RegisterMember("IdAsBsonValue", "_id", BsonValueSerializer.Instance);
45+
RegisterMember("Length", "length", new Int64Serializer());
46+
RegisterMember("MD5", "md5", new StringSerializer());
47+
RegisterMember("Metadata", "metadata", BsonDocumentSerializer.Instance);
48+
RegisterMember("UploadDateTime", "uploadDate", new DateTimeSerializer());
49+
}
50+
51+
/// <inheritdoc/>
52+
protected override GridFSFileInfo CreateInstance(BsonDocument backingDocument)
53+
{
54+
return new GridFSFileInfo(backingDocument);
55+
}
56+
}
57+
}

src/MongoDB.Driver.GridFS/MongoDB.Driver.GridFS.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<Compile Include="GridFSChunkException.cs" />
5151
<Compile Include="GridFSDownloadStreamBase.cs" />
5252
<Compile Include="GridFSException.cs" />
53+
<Compile Include="GridFSFileInfoSerializer.cs" />
5354
<Compile Include="GridFSFileNotFoundException.cs" />
5455
<Compile Include="GridFSFileInfo.cs" />
5556
<Compile Include="GridFSBucket.cs" />

0 commit comments

Comments
 (0)