May I please know where should we write the BsonClassMap.RegisterClassMap .....................................etc. If I write in my .cs file(which is a model file in mvc) Visual studio is giving me a red squiggle saying that its used as a type instead BsonClassMap.Regis....is a method.
public class class_name
{
public int xxx { get; set; }
public string xxxx { get; set; }
public List<string> ABC{ get; set; }
private bool ShouldSerializeABC()
{
return ABC.Count() > 0;
}
BsonClassMap.RegisterClassMap<class_name>(cm=>
{
cm.AutoMap();
cm.GetMemberMap(c => c.CompetitorBests)
.SetShouldSerializeABC(
obj => ((class_name)obj).ABC.Any());
}