Skip to content

Commit fa544b8

Browse files
committed
Added support for constructor injection
1 parent 82375db commit fa544b8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Bson/Serialization/BsonClassMap.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,16 @@ public void SetExtraElementsMember(BsonMemberMap memberMap)
886886

887887
_extraElementsMemberMap = memberMap;
888888
}
889+
/// <summary>
890+
/// Sets the constructor for the object
891+
/// </summary>
892+
/// <param name="constructor"></param>
893+
public BsonClassMap SetConstructor(Func<object> constructor)
894+
{
895+
this._creator = constructor;
896+
return this;
889897

898+
}
890899
/// <summary>
891900
/// Sets the Id member.
892901
/// </summary>
@@ -1384,6 +1393,8 @@ public BsonMemberMap GetMemberMap<TMember>(Expression<Func<TClass, TMember>> mem
13841393
return GetMemberMap(memberName);
13851394
}
13861395

1396+
1397+
13871398
/// <summary>
13881399
/// Creates a member map for the extra elements field and adds it to the class map.
13891400
/// </summary>

0 commit comments

Comments
 (0)