Beispiel #1
0
        /// <summary>
        /// Returns an <see cref="IDataExistenceChecker{TEntity}"/> for checking is some <typeparamref name="TEntity"/> exists in database.
        /// </summary>
        public IDataExistenceChecker <TEntity> Any <TEntity>() where TEntity : class
        {
            var type = RUtils <TEntity> .Type;

            object checker;

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

            var existenceChecker = _factory.DataExistenceChecker <TEntity>();

            if (!_existenceCheckers.TryAdd(type, existenceChecker))
            {
                return((IDataExistenceChecker <TEntity>)_getters[type]);
            }

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