private static Policy CreatePolicy(Type entityType, object id) { //根对象的检测条件由所有子对象的所有条件组合而成。 var checkers = new AggregateChecker(); checkers.Add(new VersionChecker(entityType)); var childrenTypes = new List <Type>(); GetAggregateChildrenTypes(entityType, childrenTypes); for (int i = 0, c = childrenTypes.Count; i < c; i++) { var childType = childrenTypes[i]; var childScope = CommonModel.Entities.Get(childType).ClientCacheDefinition; if (childScope != null) { if (childScope.ScopeClass != entityType) { throw new InvalidOperationException("此方法暂时只支持“所有的范围定义为根对象”!"); } checkers.Add(new VersionChecker(childType, childScope.ScopeClass, id.ToString())); } } var policy = new Policy() { Checker = checkers }; return(policy); }
private static Policy CreatePolicy(Type entityType, object id) { //根对象的检测条件由所有子对象的所有条件组合而成。 var checkers = new AggregateChecker(); checkers.Add(new VersionChecker(entityType)); var childrenTypes = new List<Type>(); GetAggregateChildrenTypes(entityType, childrenTypes); for (int i = 0, c = childrenTypes.Count; i < c; i++) { var childType = childrenTypes[i]; var childScope = CommonModel.Entities.Get(childType).ClientCacheDefinition; if (childScope != null) { if (childScope.ScopeClass != entityType) throw new InvalidOperationException("此方法暂时只支持“所有的范围定义为根对象”!"); checkers.Add(new VersionChecker(childType, childScope.ScopeClass, id.ToString())); } } var policy = new Policy() { Checker = checkers }; return policy; }