Esempio n. 1
0
 public ViewsFileUploader(string moduleName) : base(moduleName)
 {
     SourcePathFolder = "Views";
     FileIgnorance    = f => {
         if (ignorenceFiles.Contains(f.Name.ToLower()))
         {
             return(true);
         }
         return(false);
     };
     Convertors.Add(new CSHTMLFileConverter());
 }
Esempio n. 2
0
        public CacheMapRule <T> AddMember(Expression <Func <T, RedisValue> > fetcher, string key = null)
        {
            var unaryExpression = (UnaryExpression)fetcher.Body;

            while (unaryExpression.Operand.NodeType == ExpressionType.Convert) //Strip casts
            {
                unaryExpression = (UnaryExpression)unaryExpression.Operand;
            }
            var        memberExp  = (MemberExpression)unaryExpression.Operand;
            var        accessor   = fetcher.Compile();
            var        prefixes   = new List <string>();
            MemberInfo rootMember = null;

            if (memberExp.Expression.NodeType == ExpressionType.MemberAccess)
            {
                MemberExpression subExpression = (MemberExpression)memberExp.Expression;
                do
                {
                    if (rootMember == null)
                    {
                        rootMember = subExpression.Member;
                    }
                    prefixes.Add(subExpression.Member.Name);
                    if (subExpression.Expression.NodeType != ExpressionType.MemberAccess)
                    {
                        break;
                    }
                    subExpression = (MemberExpression)subExpression.Expression;
                } while (true);
            }
            if (rootMember == null)
            {
                rootMember = memberExp.Member;
            }
            //            string strPrefix = string.Join(".", prefixes.ToArray());
            //            if (strPrefix.Length > 0) strPrefix += ".";
            //var cMember = new CacheMember(strPrefix, (PropertyInfo)memberExp.Member);
            var cMember = new CacheMember("", (PropertyInfo)rootMember);

            if (!string.IsNullOrEmpty(key))
            {
                cMember.SetKey(key);
            }
            Convertors.Add(cMember.Key, accessor);
            Members[cMember.Key] = cMember;
            var newRule = new CacheMapRule <T>(this, cMember, fetcher);

            return(newRule);
        }
Esempio n. 3
0
 public PagesFileUploader(string moduleName) : base(moduleName)
 {
     SourcePathFolder = "Pages";
     Convertors.Add(new CSHTMLFileConverter());
 }