예제 #1
0
 public ConditionAttribute()
 {
     action = new ActionEntity();
     action.AssemblyName = "Application";
     action.ClassName    = "AuthUtil";
     action.MethodName   = "GetCurrentUserSite";
 }
예제 #2
0
        public ConditionFiller <TSource> FillConditionsValue()
        {
            List <ConditionPropery> conditionsProps = _builder.Get();

            foreach (var condProp in conditionsProps)
            {
                object       value  = new object();
                ActionEntity action = condProp.action;
                try
                {
                    var  executingPath = ConfigHelper.GetExecutingDirectory();
                    var  assemblyTypes = Assembly.Load(action.AssemblyName).GetTypes();
                    Type outerClass    = assemblyTypes
                                         .Single(t => !t.IsInterface && t.Name == action.ClassName);
                    object     instance = Activator.CreateInstance(outerClass, action.MethodParams.ConstructorParameters);
                    MethodInfo mi       = outerClass.GetMethod(action.MethodName);
                    value = mi.Invoke(instance, action.MethodParams.MethodParameters);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                string name = condProp.Key.PropertyName;
                _builder.AddConditionValue(name, value);
            }

            return(this);
        }
예제 #3
0
 public ConditionPropery()
 {
     Key    = new PropertyKey();
     action = new ActionEntity();
 }