File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ /* Copyright 2010-2012 10gen 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 . Attributes ;
18+ using NUnit . Framework ;
19+ using MongoDB . Bson . Serialization ;
20+ using MongoDB . Bson . Serialization . Conventions ;
21+
22+ namespace MongoDB . BsonUnitTests . Jira . CSharp708
23+ {
24+ [ TestFixture ]
25+ public class CSharp708Tests
26+ {
27+ interface IIdentity
28+ {
29+ string Id { get ; }
30+ }
31+
32+ class Entity : IIdentity
33+ {
34+ public string Id { get ; set ; }
35+ }
36+
37+ void ConfigureClassMap < T > ( BsonClassMap < T > cm )
38+ where T : class , IIdentity , new ( )
39+ {
40+ cm . SetIdMember ( cm . GetMemberMap ( c => c . Id ) . SetRepresentation ( BsonType . ObjectId ) ) ;
41+ }
42+
43+ [ Test ]
44+ public void Test ( )
45+ {
46+ var classMap = new BsonClassMap < Entity > ( ) ;
47+ classMap . AutoMap ( ) ;
48+
49+ ConfigureClassMap < Entity > ( classMap ) ;
50+ }
51+ }
52+ }
Original file line number Diff line number Diff line change 8383 <Compile Include =" BsonUtilsTests.cs" />
8484 <Compile Include =" IO\ByteArrayBufferTests.cs" />
8585 <Compile Include =" IO\MultiChunkBufferTests.cs" />
86+ <Compile Include =" Jira\CSharp708Tests.cs" />
8687 <Compile Include =" Jira\CSharp476Tests.cs" />
8788 <Compile Include =" Jira\CSharp624Tests.cs" />
8889 <Compile Include =" Jira\CSharp637Tests.cs" />
You can’t perform that action at this time.
0 commit comments