Exemple #1
0
        public DimEmployee Create(DimEmployee employeer)
        {
            try
            {
                if (multiThreaded)
                {
                    using (AdventureWorksDW2019Entities ctx = new AdventureWorksDW2019Entities())
                    {
                        ctx.Database.CommandTimeout = TimeOut;
                        return(_CreateEmployeer(employeer, ctx));
                    }
                }
                else
                {
                    return(_CreateEmployeer(employeer, ctx));
                }
            }
            catch (EntityCommandExecutionException entityCommandExecutionException)
            {
                throw;
            }

            DimEmployee _CreateEmployeer(DimEmployee _employeer, AdventureWorksDW2019Entities _ctx)
            {
                _ctx.Database.CommandTimeout = TimeOut;
                _ctx.DimEmployees.Add(_employeer);
                _ctx.SaveChanges();
                return(_employeer);
            }
        }
Exemple #2
0
 public IEnumerable <DimEmployee> GetAll()
 {
     try
     {
         if (multiThreaded)
         {
             using (AdventureWorksDW2019Entities ctx = new AdventureWorksDW2019Entities())
             {
                 ctx.Database.CommandTimeout = TimeOut;
                 return(ctx.DimEmployees.ToList());
             }
         }
         else
         {
             return(ctx.DimEmployees.ToList());
         }
     }
     catch (EntityException)
     {
         throw;
     }
 }
Exemple #3
0
 public DimEmployee GetEmployeerById(int id)
 {
     try
     {
         if (multiThreaded)
         {
             using (AdventureWorksDW2019Entities ctx = new AdventureWorksDW2019Entities())
             {
                 ctx.Database.CommandTimeout = TimeOut;
                 return(ctx.DimEmployees.SingleOrDefault(d => d.EmployeeKey == id));
             }
         }
         else
         {
             return(ctx.DimEmployees.SingleOrDefault(d => d.EmployeeKey == id));
         }
     }
     catch (EntityCommandExecutionException entityCommandExecutionException)
     {
         throw;
     }
 }
Exemple #4
0
 public EmployeerM() : this(false)
 {
     ctx = new AdventureWorksDW2019Entities();
     ctx.Database.CommandTimeout = TimeOut;
 }