示例#1
0
 public virtual void DeleteExecution(ExecutionEntity execution)
 {
     Log.LogDebug("EF删除数据DeleteExecution:", execution.Id);
     Delete(execution);
     if (execution.IsProcessInstanceExecution)
     {
         DeleteAuthorizations(Resources.ProcessInstance, execution.ProcessInstanceId);
     }
 }
示例#2
0
 /// <summary>
 /// Id为Null时调用Id生成器
 /// </summary>
 /// <param name="dbEntity"></param>
 public override TEntity Add(TEntity dbEntity)
 {
     EnsureHasId(dbEntity);
     ValidateId(dbEntity);
     Log.LogDebug("EF插入缓存:", $"{dbEntity.GetType().Name} {dbEntity.Id}");
     return(base.Add(dbEntity));
 }
        public virtual void DeleteEventSubscription(EventSubscriptionEntity persistentObject)
        {
            Log.LogDebug("EFɾ³ý»º´æEventSubscriptionEntity,", "id:" + persistentObject.Id);
            Delete(persistentObject);
            if (persistentObject.IsSubscriptionForEventType(EventType.Signal))
            {
                CreatedSignalSubscriptions.Remove(persistentObject);
            }

            // if the event subscription has been triggered asynchronously but not yet executed
            IList <JobEntity> asyncJobs = _jobManager.FindJobsByConfiguration(ProcessEventJobHandler.TYPE, persistentObject.Id, persistentObject.TenantId);

            foreach (JobEntity asyncJob in asyncJobs)
            {
                asyncJob.Delete();
            }
        }
示例#4
0
        /// <summary>
        /// 更新Entity除id外所有属性值
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="db"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public static T UpDate <T>(T db, T model) where T : IDbEntity
        {
            if (db == null)
            {
                EnginePersistenceLogger Log = ProcessEngineLogger.PersistenceLogger;
                Log.LogDebug("更新数据失败", string.Format("EF缓存/数据库中找不到{0} Id:{1}", typeof(T).Name, model.Id));
                throw new System.Exception(string.Format("更新数据失败 EF缓存/数据库中找不到{0} Id:{1}", typeof(T).Name, model.Id));
            }
            if (db.Id != model.Id)
            {
                throw new System.Exception($"id不同 {typeof(T).Name} db.id:{db.Id} model.id{model.Id}");
            }
            Type t = typeof(T);

            foreach (PropertyInfo item in t.GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                if (item.Name == "Id")
                {
                    continue;
                }
                if (item.GetMethod != null && item.SetMethod != null)
                {
                    try
                    {
                        var resultVal = item.GetValue(model);
                        if (resultVal != null)
                        {
                            item.SetValue(db, item.GetValue(model));
                        }
                    }
                    catch (ArgumentException e)
                    {
                        throw new ArgumentException($"Update异常:类型 {t.Name } 属性 {item.Name}", e);
                    }
                }
            }
            return(db);
        }
示例#5
0
 public DbEntityCache()
 {
     CacheKeyMapping = DbEntityCacheKeyMapping.EmptyMapping();
     Log.LogDebug("缓存无参构造函数", "DbEntityCacheKeyMapping.EmptyMapping");
 }