Пример #1
0
        private PancakeContext _db; //todo: подключение должно быть одно на все сервисы?

        public void Init(PancakeConfiguration configuration)
        {
            try
            {
                _db           = new PancakeContext(configuration);
                IsInitialized = true;
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error connecting to database: {e}");
                throw;
            }
        }
Пример #2
0
 public void Init(PancakeConfiguration configuration)
 {
     if (!IsInitialized)
     {
         try
         {
             _db           = new PancakeContext(configuration);
             IsInitialized = true;
         }
         catch (Exception e)
         {
             Console.WriteLine($"Error connecting to database: {e}");
             throw;
         }
     }
     else
     {
         Console.WriteLine($"RandomWordsService already initialized!");
     }
 }