コード例 #1
0
        public IRestItem GetItem(string identifier)
        {
            _context.Transaction.StartTransaction();

            // create item using only the identifier info given to the dictionary.
            IDeferredItem <TItem> item = EngineIdentiferUtility.GetIdentifiedItem(_context, _namedReferenceInfo, identifier);

            if (!_context.AuthorizationChecker.CanGetItem(item))
            {
                throw new NotAuthorizedForItemException(AuthorizableVerb.Get);
            }

            return(new EngineRestItem <TItem>(_context, item));
        }
コード例 #2
0
        public IRestItem GetItem(string identifier, string identifierName = null)
        {
            _context.Transaction.StartTransaction();

            IIdentifierInfo <TItem> identifierInfo = _context.Identifiers.GetInfo(identifierName);

            if (identifierInfo == null)
            {
                throw new IdentifierNotFoundException(identifierName);
            }

            IDeferredItem <TItem> item = EngineIdentiferUtility.GetIdentifiedItem(_context, identifierInfo, identifier);

            if (!_context.AuthorizationChecker.CanGetItem(item))
            {
                throw new NotAuthorizedForItemException(AuthorizableVerb.Get);
            }

            return(new EngineRestItem <TItem>(_context, item));
        }