Пример #1
0
 public static void Add(Type entityClassType, string soapClassName, PropertyMapperList mapper = null, bool throwExceptionWhenAddDuplicatedMapping = false)
 {
     if (s_Cache1.ContainsKey(SoapClient.Namespace + "." + soapClassName))
     {
         if (throwExceptionWhenAddDuplicatedMapping)
         {
             throw new ApplicationException("Duplicated mapping for soap class name '" + soapClassName + "'.");
         }
         return;
     }
     if (s_Cache2.ContainsKey(entityClassType))
     {
         if (throwExceptionWhenAddDuplicatedMapping)
         {
             throw new ApplicationException("Duplicated mapping for entity class '" + entityClassType.FullName + "'.");
         }
         return;
     }
     if (mapper == null)
     {
         mapper = new PropertyMapperList();
         var infoList = entityClassType.GetProperties();
         foreach (var info in infoList)
         {
             if (info.CanRead)
             {
                 mapper.Add(info.Name);
             }
         }
     }
     s_Cache1.Add(SoapClient.Namespace + "." + soapClassName, new Tuple <Type, string, PropertyMapperList>(entityClassType, soapClassName, mapper));
     s_Cache2.Add(entityClassType, new Tuple <Type, string, PropertyMapperList>(entityClassType, soapClassName, mapper));
 }
Пример #2
0
 public static void Add <T>(string soapClassName, PropertyMapperList mapper = null, bool throwExceptionWhenAddDuplicatedMapping = false)
 {
     Add(typeof(T), soapClassName, mapper, throwExceptionWhenAddDuplicatedMapping);
 }