Exemplo n.º 1
0
 public ExcelQueryable(ExcelQueryArgs args)
     : base(CreateExecutor(args))
 {
     foreach (var property in typeof(T).GetProperties())
     {
         ExcelColumnAttribute att
             = (ExcelColumnAttribute)Attribute.GetCustomAttribute(property, typeof(ExcelColumnAttribute));
         att.Register(args, property);
     }
 }
Exemplo n.º 2
0
 public ExcelQueryable(ExcelQueryArgs args)
     : base(CreateExecutor(args))
 {
     foreach (var property in typeof(T).GetProperties())
     {
         ExcelColumnAttribute att = (ExcelColumnAttribute)Attribute.GetCustomAttribute(property, typeof(ExcelColumnAttribute));
         if (att != null && !args.ColumnMappings.ContainsKey(property.Name))
         {
             args.ColumnMappings.Add(property.Name, att.ColumnName);
         }
     }
 }
        internal SqlGeneratorQueryModelVisitor(ExcelQueryArgs args)
        {
            _args              = args;
            SqlStatement       = new SqlParts();
            SqlStatement.Table = (String.IsNullOrEmpty(_args.StartRange)) ?
                                 !String.IsNullOrEmpty(_args.NamedRangeName) && String.IsNullOrEmpty(_args.WorksheetName) ?
                                 string.Format("[{0}]",
                                               _args.NamedRangeName) :
                                 string.Format("[{0}${1}]",
                                               _args.WorksheetName, _args.NamedRangeName) :
                                 string.Format("[{0}${1}:{2}]",
                                               _args.WorksheetName, _args.StartRange, _args.EndRange);

            if (!string.IsNullOrEmpty(_args.WorksheetName) && _args.WorksheetName.ToLower().EndsWith(".csv"))
            {
                SqlStatement.Table = SqlStatement.Table.Replace("$]", "]");
            }
        }
Exemplo n.º 4
0
 private static IQueryExecutor CreateExecutor(ExcelQueryArgs args)
 {
     return(new ExcelQueryExecutor(args));
 }