public override void Verify(Adapters.IContainerAdapter container)
 {
     if (Singleton1.Instances != this.LoopCount)
     {
         throw new Exception(string.Format("Singleton1 count must be {0}", this.LoopCount));
     }
 }
 public override void Verify(Adapters.IContainerAdapter container)
 {
     if (Singleton1.Instances > 1 || Singleton2.Instances > 1 || Singleton2.Instances > 1)
     {
         throw new Exception("Singleton instance count must be 1. Container: " + container.Name);
     }
 }
 public override void Verify(Adapters.IContainerAdapter container)
 {
     if (Transient1.Instances != this.LoopCount
         || Transient2.Instances != this.LoopCount
         || Transient3.Instances != this.LoopCount)
     {
         throw new Exception(string.Format("Transient count must be {0}", this.LoopCount));
     }
 }
 public override void Verify(Adapters.IContainerAdapter container)
 {
     if (Complex1.Instances != this.LoopCount
         || Complex2.Instances != this.LoopCount
         || Complex3.Instances != this.LoopCount)
     {
         throw new Exception(string.Format("Complex count must be {0}", this.LoopCount));
     }
 }
        public override void Verify(Adapters.IContainerAdapter container)
        {
            if (!container.SupportsInterception)
            {
                return;
            }

            if (Calculator1.Instances != this.LoopCount
                || Calculator2.Instances != this.LoopCount
                || Calculator3.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("Calculator count must be {0}", this.LoopCount));
            }
        }
        public override void Verify(Adapters.IContainerAdapter container)
        {
            if (!container.SupportGeneric)
            {
                return;
            }

            if (ImportGeneric<int>.Instances != this.LoopCount
                || ImportGeneric<float>.Instances != this.LoopCount
                || ImportGeneric<object>.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("ImportGeneric count must be {0}", this.LoopCount));
            }
        }
        public override void Verify(Adapters.IContainerAdapter container)
        {
            if (!container.SupportsConditional)
            {
                return;
            }

            if (ImportConditionObject1.Instances != this.LoopCount
                || ImportConditionObject2.Instances != this.LoopCount
                || ImportConditionObject3.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("ImportConditionObject count must be {0}", this.LoopCount));
            }
        }
        public override void Verify(Adapters.IContainerAdapter container)
        {
            if (!container.SupportsPropertyInjection)
            {
                return;
            }

            if (ComplexPropertyObject1.Instances != this.LoopCount
                || ComplexPropertyObject2.Instances != this.LoopCount
                || ComplexPropertyObject3.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("ComplexPropertyObject count must be {0}", this.LoopCount));
            }
        }
        public override void Verify(Adapters.IContainerAdapter container)
        {
            if (!container.SupportsChildContainer)
            {
                return;
            }

            if (ScopedCombined1.Instances != this.LoopCount
                || ScopedCombined2.Instances != this.LoopCount
                || ScopedCombined3.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("ScopedCombined count must be {0}", this.LoopCount));
            }
        }
        public override void Verify(Adapters.IContainerAdapter container)
        {
            if (!container.SupportsMultiple)
            {
                return;
            }

            if (ImportMultiple1.Instances != this.LoopCount
                || ImportMultiple2.Instances != this.LoopCount
                || ImportMultiple3.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("ImportMultiple count must be {0}", this.LoopCount));
            }
        }
        public override void Verify(Adapters.IContainerAdapter container)
        {
            if (Combined1.Instances != this.LoopCount
                || Combined2.Instances != this.LoopCount
                || Combined3.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("Combined count must be {0}", this.LoopCount));
            }

            if (Transient1.Instances != this.LoopCount
                || Transient2.Instances != this.LoopCount
                || Transient3.Instances != this.LoopCount)
            {
                throw new Exception(string.Format("Transient count must be {0}", this.LoopCount));
            }

            if (Singleton1.Instances > 1 || Singleton2.Instances > 1 || Singleton2.Instances > 1)
            {
                throw new Exception("Singleton instance count must be 1. Container: " + container.Name);
            }
        }
 public ContainerAdapterInfo(Adapters.IContainerAdapter container)
 {
     this.Name = container.Name;
     this.Url = container.Url;
     this.Version = container.Version;
 }
		protected override object DoOperation(Adapters.SchemaObjectOperationContext context)
		{
			SchemaObjectAdapter.Instance.Update(this._Object);

			return this._Object;
		}
		protected override object DoOperation(Adapters.SchemaObjectOperationContext context)
		{
			int replacedCount = 0;

			//取父级的权限定义
			var aclMembers = Adapters.SCAclAdapter.Instance.LoadByContainerID(((SchemaObjectBase)(this._Parent)).ID, DateTime.MinValue);

			InSqlClauseBuilder inBuilder = new InSqlClauseBuilder("ID");
			inBuilder.AppendItem((from acl in aclMembers select acl.MemberID).ToArray());

			WhereSqlClauseBuilder where = new WhereSqlClauseBuilder();
			where.AppendItem("Status", (int)SchemaObjectStatus.Normal);

			if (inBuilder.IsEmpty)
				where.AppendItem("1", "2");

			var memberObjects = Adapters.SchemaObjectAdapter.Instance.Load(new ConnectiveSqlClauseCollection(inBuilder, where), DateTime.MinValue);

			if (this._Candidates.Count > 0)
			{
				ProcessProgress.Current.MaxStep = this._Candidates.Count;
				ProcessProgress.Current.CurrentStep = 0;

				ProcessProgress.Current.Output.WriteLine("正在替换子对象ACL");

				foreach (SchemaObjectBase candidate in this._Candidates)
				{
					string objName = candidate.Properties.GetValue("Name", string.Empty);

					try
					{
						Debug.Assert(this._Parent != null, "容器对象为null");

						var oldItems = SCAclAdapter.Instance.LoadByContainerID(candidate.ID, DateTime.MinValue);

						var container = new SCAclContainer(candidate);

						foreach (var item in aclMembers)
							if (item.Status == SchemaObjectStatus.Normal)
								container.Members.Add(item.ContainerPermission, memberObjects[item.MemberID]);


						if (oldItems != null)
						{
							container.Members.MergeChangedItems(oldItems);
						}

						SCObjectOperations.Instance.UpdateObjectAcl(container);

						if (SCDataOperationLockContext.Current.Lock != null && (replacedCount) % 5 == 0)
							SCDataOperationLockContext.Current.ExtendLock();

						replacedCount++;

						ProcessProgress.Current.StatusText = string.Format("已替换\"{0}\"的Acl", objName);
						ProcessProgress.Current.Increment();
						ProcessProgress.Current.Response();
					}
					catch (System.Exception ex)
					{
						throw new ApplicationException(string.Format("替换对象{0}({1})的Acl出错: {2}", objName, candidate.ID, ex.Message));
					}
				}
			}
			else
			{
				ProcessProgress.Current.Output.WriteLine("当前对象没有子对象ACL");
				ProcessProgress.Current.CurrentStep = ProcessProgress.Current.MaxStep = 1;
			}

			ProcessProgress.Current.StatusText = string.Format("总共替换了{0:#,##0}个对象的Acl", replacedCount);
			ProcessProgress.Current.Response();

			return this._Parent;
		}