Пример #1
0
        public RefreshRowInfo ServiceRefreshRow(RefreshRowInfo getInfo)
        {
            RefreshRowInfo res = null;

            this._currentOperation = ServiceOperationType.RefreshRowData;
            try
            {
                res = this.RefreshRowInfo(getInfo);
            }
            catch (Exception ex)
            {
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }
                res = new RefreshRowInfo {
                    dbSetName = getInfo.dbSetName, error = new ErrorInfo(ex.Message, ex.GetType().Name), rowInfo = null
                };
                this.OnError(ex);
            }
            finally
            {
                this._currentOperation = ServiceOperationType.None;
            }
            return(res);
        }
Пример #2
0
        protected RefreshRowInfo RefreshRowInfo(RefreshRowInfo info)
        {
            var metadata = this.EnsureMetadataInitialized();

            info.dbSetInfo = metadata.dbSets[info.dbSetName];
            MethodInfo methInfo = this.GetOperMethodInfo(info.dbSetInfo, OperationNames.REFRESH);

            if (methInfo == null)
            {
                throw new InvalidOperationException(string.Format(ErrorStrings.ERR_REC_REFRESH_INVALID, info.dbSetInfo.EntityType.Name, this.GetType().Name));
            }
            info.rowInfo.dbSetInfo = info.dbSetInfo;
            this.Authorizer.CheckUserRightsToExecute(methInfo);
            object dbEntity = methInfo.Invoke(this, new object[] { info });
            var    rri      = new RefreshRowInfo {
                rowInfo = info.rowInfo, dbSetName = info.dbSetName
            };

            if (dbEntity != null)
            {
                UpdateRowInfoFromEntity(dbEntity, info.rowInfo);
            }
            else
            {
                rri.rowInfo = null;
            }
            return(rri);
        }
Пример #3
0
 protected virtual T GetRefreshedEntity <T>(IQueryable <T> entities, RefreshRowInfo info)
     where T : class
 {
     return(this.QueryHelper.GetRefreshedEntity <T>(entities, info));
 }