//------------------------------------------------------ //--Plugin Services //------------------------------------------------------ public string GetEntityDiscriminator(Type mappedEntityType, Type knownEntityType) { if (mappedEntityType == null) { throw new ArgumentNullException(nameof(mappedEntityType), "Mapped entity type not specified."); } if (knownEntityType == null) { throw new ArgumentNullException(nameof(knownEntityType), "Derived known type of mapped type not specified,"); } IEntityClassMap entityMapping = GetEntityMap(mappedEntityType); if (entityMapping == null) { throw new InvalidOperationException( $"Mapping is not registered for the class type: {mappedEntityType}."); } var knownType = entityMapping.ClassMap.KnownTypes .FirstOrDefault(kt => kt == knownEntityType); if (knownType == null) { throw new InvalidOperationException( $"The type of: {knownEntityType.FullName} is not a configured know type of: {mappedEntityType.FullName}"); } var knowTypeMap = GetEntityMap(knownType); return(knowTypeMap?.ClassMap.Discriminator ?? knownType.Name); }
private string GetEntityCollectionName(IEntityClassMap mapping) { return(mapping.CollectionName ?? mapping.EntityType.FullName); }