/// <summary>
        ///     Get a mapper.
        /// </summary>
        /// <typeparam name="TEntity">Type of entity to get a mapper for.</typeparam>
        /// <exception cref="MappingNotFoundException">Did not find a mapper for the specified entity.</exception>
        /// <returns></returns>
        public static IEntityMapper <TEntity> GetMapper <TEntity>()
        {
            if (!_scanned && _provider is AssemblyScanningMappingProvider)
            {
                _scanned = true;
                ((AssemblyScanningMappingProvider)_provider).Scan();
            }

            var mapper = (IEntityMapper <TEntity>)_provider.Get <TEntity>();

            return(mapper);
        }
        /// <summary>
        ///     Get a mapper.
        /// </summary>
        /// <typeparam name="TEntity">Type of entity to get a mapper for.</typeparam>
        /// <exception cref="MappingNotFoundException">Did not find a mapper for the specified entity.</exception>
        /// <returns></returns>
        public static ICrudEntityMapper <TEntity> GetMapper <TEntity>()
        {
            EnsureThatAssembliesHaveBeenScanned();

            var mapperFound = _provider.Get <TEntity>();
            var mapper      = mapperFound as ICrudEntityMapper <TEntity>;

            if (mapper == null)
            {
                throw new MappingException(typeof(TEntity),
                                           "Expected to find a ICrudEntityMapper but only found a IEntityMapper for the requested operation to work. Found mapper: " +
                                           mapperFound.GetType().FullName);
            }
            return(mapper);
        }