Exemple #1
0
        public int CompareTo(object obj)
        {
            if (obj is ContractInfo)
            {
                ContractInfo other = (ContractInfo)obj;

                // 根据名称进行比较
                return(this.ContractType.FullName.CompareTo(other.ContractType.FullName));
            }
            else
            {
                throw new ArgumentException("The target object is not a <ContractInfo>.");
            }
        }
Exemple #2
0
        private static ReadOnlyCollection<ContractInfo> ScanAssembly(Assembly assembly)
        {
            List<ContractInfo> contracts = new List<ContractInfo>();

              ReadOnlyCollection<CustomAttributeData> attributes = CustomAttributeHelper.GetCustomAttributes(assembly, typeof(ManagedServiceContractAssemblyAttribute));
              if (attributes.Count > 0)
              {
            foreach (Type type in assembly.GetTypes())
            {
              bool isContractType = ScanType(type);
              if (isContractType)
              {
            ContractInfo info = new ContractInfo() { ContractType = type };
            if (!contracts.Contains(info))
            {
              contracts.Add(info);
            }
              }
            }
              }

              return contracts.AsReadOnly();
        }