コード例 #1
0
        public ModelValueProvider(string fieldOrPropertyChain, Type modelType, PropertyInfo modelProperty, Action <bool, string> addError)
        {
            if (modelType == null)
            {
                addError(false, EmailTemplateMessage.ImpossibleToAccess0BecauseTheTemplateHAsNo1.NiceToString(fieldOrPropertyChain, modelProperty.NiceName()));
                return;
            }

            this.Members = ParsedModel.GetMembers(modelType, fieldOrPropertyChain, addError);
        }
コード例 #2
0
        public GlobalValueProvider(string fieldOrPropertyChain, Action <bool, string> addError)
        {
            globalKey = fieldOrPropertyChain.TryBefore('.') ?? fieldOrPropertyChain;
            remainingFieldsOrProperties = fieldOrPropertyChain.TryAfter('.');

            var gv = GlobalVariables.TryGetC(globalKey);

            if (gv == null)
            {
                addError(false, "The global key {0} was not found".FormatWith(globalKey));
            }

            if (remainingFieldsOrProperties != null && gv != null)
            {
                this.Members = ParsedModel.GetMembers(gv.Type, remainingFieldsOrProperties, addError);
            }
        }
コード例 #3
0
        public ContinueValueProvider(string fieldOrPropertyChain, ValueProviderBase parent, Action <bool, string> addError)
        {
            this.Parent = parent;

            this.Members = ParsedModel.GetMembers(ParentType(), fieldOrPropertyChain, addError);
        }