Esempio n. 1
0
        public DirectiveCollection(IMother mother, IDirective parent)
        {
            this._Queued = new ConcurrentQueue <int>();

            this._Mother = mother;
            this._Parent = parent;
        }
        protected static IList <TEntity> Birth <TEntity>(IMother <TEntity> mother, string message, ConsoleTicker consoleTicker, int?takeLimit = null)
            where TEntity : class
        {
            var tickedMessage = message == null || consoleTicker == null ? null : message + "...";
            var entities      = mother.BirthAll(tickedMessage == null ? (Action)null : () => consoleTicker.TickConsole(tickedMessage));

            return(takeLimit != null?entities.Take(takeLimit.Value).ToList() : entities.ToList());
        }
        protected static void LoadRecords <T>(IBulkInsertContext context, IMother <T> mother, string message, ConsoleTicker consoleTicker, int?takeLimit = null)
            where T : class
        {
            var records = Birth(mother, message, consoleTicker, takeLimit);

            if (message != null && consoleTicker != null)
            {
                Console.Write("\r");
            }
            LoadRecords(context, records, message, consoleTicker, takeLimit);
        }
 public InfrastructureDataModelContext(IMother motherData)
 {
     _motherData = motherData;
 }
Esempio n. 5
0
 public RequestBinUnitOfWorkModel(IMother motherData)
 {
     _context = new RequestBinModelContext(motherData.Data);
 }
Esempio n. 6
0
        private static List <TEntity> LoadProducts <TEntity>(IBulkInsertContext newContext, IMother <TEntity> mother, ConsoleTicker consoleTicker, string message, Func <TEntity, Product> productSelector = null) where TEntity : class
        {
            var products = mother.BirthAll(() => consoleTicker.TickConsole(message + "...")).ToList();

            consoleTicker.ReplaceCurrentLine(message);

            if (productSelector != null)
            {
                LoadRecords(newContext, products.Select(productSelector), "\t\tproducts", consoleTicker);
            }
            LoadRecords(newContext, products, "\t" + message.ToLower(), consoleTicker);

            return(products);
        }