Exemple #1
0
        private static SchemaObjectCollection GetObjects(string[] keys, BatchExecuteCardinality cardinality, IBatchErrorAdapter errors)
        {
            SchemaObjectCollection result = null;

            if ((cardinality & BatchExecuteCardinality.Mandatory) == BatchExecuteCardinality.Mandatory)
            {
                // 至少含有一个
                if (keys == null || keys.Length == 0)
                {
                    throw new ArgumentOutOfRangeException("keys", keys, "需要至少一个对象");
                }
            }

            if ((cardinality & BatchExecuteCardinality.One) == BatchExecuteCardinality.One)
            {
                if (keys != null && keys.Length > 1)
                {
                    throw new ArgumentOutOfRangeException("keys", keys, "只能指定一个对象");
                }
            }

            if (keys != null && keys.Length > 0)
            {
                result = DbUtil.LoadAndCheckObjects("对象", errors, keys);
            }
            else
            {
                result = new SchemaObjectCollection();
            }

            return(result);
        }
		private static SchemaObjectCollection GetObjects(string[] keys, BatchExecuteCardinality cardinality, IBatchErrorAdapter errors)
		{
			SchemaObjectCollection result = null;
			if ((cardinality & BatchExecuteCardinality.Mandatory) == BatchExecuteCardinality.Mandatory)
			{
				// 至少含有一个
				if (keys == null || keys.Length == 0)
				{
					throw new ArgumentOutOfRangeException("keys", keys, "需要至少一个对象");
				}
			}

			if ((cardinality & BatchExecuteCardinality.One) == BatchExecuteCardinality.One)
			{
				if (keys != null && keys.Length > 1)
				{
					throw new ArgumentOutOfRangeException("keys", keys, "只能指定一个对象");
				}
			}

			if (keys != null && keys.Length > 0)
			{
				result = DbUtil.LoadAndCheckObjects("对象", errors, keys);
			}
			else
			{
				result = new SchemaObjectCollection();
			}

			return result;
		}