public void Setup() { EntityMapping.TryRegisterType(typeof(TestModel), out _); Connection = BenchmarkDb.GetConnection(); //Pre-JIT the benchmarks to avoid issues with benchmark FirstOrDefault(); ToArray(); Count(); Any(); }
public void ApplyMapping(IEntityDefinition definition, BsonClassMap classMap) { var entityType = definition.EntityType; var bsonKnownTypesAttribute = entityType.GetCustomAttribute <BsonKnownTypesAttribute>(); if (bsonKnownTypesAttribute != null) { foreach (var type in bsonKnownTypesAttribute.KnownTypes) { EntityMapping.TryRegisterType(type, out _); } } }
public void ApplyMapping(IEntityDefinition definition, BsonClassMap classMap) { var entityType = definition.EntityType; if (EntityMapping.IsValidTypeToMap(entityType.BaseType)) { EntityMapping.TryRegisterType(entityType.BaseType, out _); } else { classMap.SetIsRootClass(true); } }
public void ApplyMapping(IEntityDefinition definition, BsonClassMap classMap) { var entityType = definition.EntityType; var properties = definition.Properties; foreach (var property in properties) { var propertyType = property.PropertyType; propertyType = propertyType.GetEnumerableItemTypeOrDefault(); //Maps the property type for handling property nesting if (propertyType != entityType && EntityMapping.IsValidTypeToMap(propertyType)) { EntityMapping.TryRegisterType(propertyType, out _); } } }