I have classes
[MongoDiscriminated] public abstract class Content { public int? Id { get; set; } public int? ParentId { get; set; } public string Slug { get; set; } public string Path { get; set; } public string Title { get; set; } } public class Area : Content { } Query like this works
var item = mongo.GetCollection<Area>().AsQueryable().FirstOrDefault(); But when I make a query like
var item = mongo.GetCollection<Content>().AsQueryable().FirstOrDefault(); I get an InvalidCastException
Object must implement IConvertible. What's wrong? It shouldn't be a problem to convert Area to Content. Do I really have to make Content to implement IConvertible?