コード例 #1
0
        /// <inheritdoc />
        public async Task <T> LoadAsync <T>(string id, CancellationToken token = default(CancellationToken))
        {
            var loadOperation = new LoadOperation(this);

            loadOperation.ById(id);

            var command = loadOperation.CreateRequest();

            if (command != null)
            {
                await RequestExecutor.ExecuteAsync(command, Context, token, SessionInfo).ConfigureAwait(false);

                loadOperation.SetResult(command.Result);
            }

            return(loadOperation.GetDocument <T>());
        }
コード例 #2
0
        /// <summary>
        /// Loads the specified entity with the specified id.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public T Load <T>(string id)
        {
            if (id == null)
            {
                return(default(T));
            }
            var loadOeration = new LoadOperation(this);

            loadOeration.ById(id);

            var command = loadOeration.CreateRequest();

            if (command != null)
            {
                RequestExecuter.Execute(command, Context);
                loadOeration.SetResult(command.Result);
            }

            return(loadOeration.GetDocument <T>());
        }