示例#1
0
        public TLogRow(ILogger <TLogRow <TSchema> > logger, IConfiguration cfg, ETLContext ctx)
        {
            Contract.Requires(logger != null, "logger cannot be null. Use the DI ");
            Contract.Requires(cfg != null, "configuration cannot be null. Use the DI ");
            Contract.Requires(ctx != null, "context cannot be null. Use the DI ");
            this._logger = logger;

            _properties     = typeof(TSchema).GetProperties().Where(p => p.GetCustomAttribute <LogIgnoreAttribute>() == null).OrderBy(p => p.Name).ToList();
            _numberOfColumn = _properties.Count();
            _widthes        = new int[_numberOfColumn];
            var row = new List <string>();

            foreach (var(item, index) in _properties.WithIndex())
            {
                var value = item.GetCustomAttribute <LogHeaderAttribute>()?.Title ?? item.Name;
                row.Add(value);
                _widthes[index] = Math.Max(_widthes[index], value.Length);
            }
            _buffer.Add(row.ToArray());
        }
示例#2
0
 public static void CreateBag(this ETLContext ctx, string name)
 {
     ctx.Bags[name] = ETLGlobal.Create();
 }
示例#3
0
 /// <summary>
 /// Force to use ETLContext
 /// </summary>
 public Job(ETLContext ctx)
 {
     Contract.Requires(ctx != null, "ETLContext cannot be null. Use the DI");
     this.Context = ctx;
 }