public SCADAModelEFDatabaseTransaction(SCADAModelDBContext context)
 {
     tables = new Dictionary <ESCADAModelDatabaseTables, ITableContext>(3)
     {
         { ESCADAModelDatabaseTables.Analogs, new EFTableContext(new EFTable <AnalogDBModel>(), context) },
         { ESCADAModelDatabaseTables.Discretes, new EFTableContext(new EFTable <DiscreteDBModel>(), context) }
     };
 }
        public bool Transact(Func <IDatabaseTransaction <ESCADAModelDatabaseTables>, bool> f)
        {
            try
            {
                using (SCADAModelDBContext context = new SCADAModelDBContext())
                {
                    if (f(new SCADAModelEFDatabaseTransaction(context)))
                    {
                        context.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }

            return(true);
        }