[CSHARP-2194] Make IMongoCollection covariant Created: 15/Feb/18 Updated: 27/Oct/23 Resolved: 30/Jan/19 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.5 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Adrian Pinter | Assignee: | Vincent Kam (Inactive) |
| Resolution: | Works as Designed | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
For my app, I'd like to define the following property on my data context class: public IMongoCollection<BsonDocument> C => data.GetCollection<RawBsonDocument>( "c" ); My purpose is to have a single IMongoCollection instance from which I can retrieve raw documents, but into which I can also insert non-raw ones. This improvement involves adding `out` to IMongoCollection's definition: public interface IMongoCollection<out TDocument> |
| Comments |
| Comment by Vincent Kam (Inactive) [ 30/Jan/19 ] |
|
Hello HappyNomad, |