Пример #1
0
        public CompositeType TestFaults(CompositeType composite)
        {
            if (composite == null)
            {
                // 异常处理的第二种方式:
                // 使用强类型Faults

                SystemFault sf = new SystemFault() {
                    SystemOperation = "TestFaults",
                    SystemReason = "composite is null",
                    SystemMessage = "传入的参数不能为 NULL !"
                };

                throw new FaultException<SystemFault>(sf);
            }

            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
Пример #2
0
        public CompositeType TestFaults(CompositeType composite)
        {
            if (composite == null)
            {
                // 异常处理的第二种方式:
                // 使用强类型Faults

                SystemFault sf = new SystemFault()
                {
                    SystemOperation = "TestFaults",
                    SystemReason    = "composite is null",
                    SystemMessage   = "传入的参数不能为 NULL !"
                };

                throw new FaultException <SystemFault>(sf);
            }


            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return(composite);
        }