internal static bool TryCreatePredicateFromBifInfo(TypeMapping[] mappings, RuleBifurcationInfo bifInfo1, RuleBifurcationInfo bifInfo2, out TransportRulePredicate predicate, out bool twoBifInfoConverted)
 {
     foreach (TypeMapping typeMapping in mappings)
     {
         if (typeMapping.Type.IsSubclassOf(typeof(BifurcationInfoPredicate)))
         {
             MethodInfo method = typeMapping.Type.GetMethod("CreatePredicateFromBifInfo", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[]
             {
                 typeof(RuleBifurcationInfo)
             }, null);
             TransportRulePredicate transportRulePredicate;
             if (method != null)
             {
                 transportRulePredicate = (TransportRulePredicate)method.Invoke(null, new object[]
                 {
                     bifInfo1
                 });
                 if (transportRulePredicate != null)
                 {
                     twoBifInfoConverted = false;
                     predicate           = transportRulePredicate;
                     predicate.Initialize(mappings);
                     return(true);
                 }
             }
             if (bifInfo2 == null)
             {
                 goto IL_116;
             }
             method = typeMapping.Type.GetMethod("CreatePredicateFromBifInfo", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[]
             {
                 typeof(RuleBifurcationInfo),
                 typeof(RuleBifurcationInfo)
             }, null);
             if (!(method != null))
             {
                 goto IL_116;
             }
             transportRulePredicate = (TransportRulePredicate)method.Invoke(null, new object[]
             {
                 bifInfo1,
                 bifInfo2
             });
             if (transportRulePredicate == null)
             {
                 goto IL_116;
             }
             twoBifInfoConverted = true;
             predicate           = transportRulePredicate;
             predicate.Initialize(mappings);
             return(true);
         }
         IL_116 :;
     }
     predicate           = null;
     twoBifInfoConverted = false;
     return(false);
 }
Esempio n. 2
0
 internal static bool TryCreatePredicateFromCondition(TypeMapping[] mappings, Condition condition, out TransportRulePredicate predicate, IConfigDataProvider session)
 {
     foreach (TypeMapping typeMapping in mappings)
     {
         MethodInfo method = typeMapping.Type.GetMethod("CreateFromInternalConditionWithSession", BindingFlags.Static | BindingFlags.NonPublic);
         if (null != method)
         {
             TransportRulePredicate transportRulePredicate = (TransportRulePredicate)method.Invoke(null, new object[]
             {
                 condition,
                 session
             });
             if (transportRulePredicate != null)
             {
                 predicate = transportRulePredicate;
                 predicate.Initialize(mappings);
                 return(true);
             }
         }
         MethodInfo method2 = typeMapping.Type.GetMethod("CreateFromInternalCondition", BindingFlags.Static | BindingFlags.NonPublic);
         if (null != method2)
         {
             TransportRulePredicate transportRulePredicate = (TransportRulePredicate)method2.Invoke(null, new object[]
             {
                 condition
             });
             if (transportRulePredicate != null)
             {
                 predicate = transportRulePredicate;
                 predicate.Initialize(mappings);
                 return(true);
             }
         }
     }
     predicate = null;
     return(false);
 }