Beispiel #1
0
        /// <summary>
        /// Returns an <see cref="IDataCountChecker{TEntity}"/> for getting count of some <typeparamref name="TEntity"/> in database.
        /// </summary>
        public IDataCountChecker <TEntity> CountOf <TEntity>() where TEntity : class
        {
            var type = RUtils <TEntity> .Type;

            object checker;

            if (_countCheckers.TryGetValue(type, out checker))
            {
                return((IDataCountChecker <TEntity>)checker);
            }

            var countChecker = _factory.DataCountChecker <TEntity>();

            if (!_countCheckers.TryAdd(type, countChecker))
            {
                return((IDataCountChecker <TEntity>)_getters[type]);
            }

            return(countChecker);
        }
 /// <summary>
 /// Instantinate an <see cref="IDataExistenceChecker{TEntity}"/>.
 /// This method will be called one time for every <typeparamref name="TEntity"/>.
 /// </summary>
 public IDataCountChecker <TEntity> DataCountChecker <TEntity>() where TEntity : class
 {
     return(_factory.DataCountChecker <TEntity>());
 }