示例#1
0
        public GameEngine(string connectionString, string versionNumber, string versionFile)
        {
            _connectionString = connectionString;
            DatabaseHelper.Actualize(connectionString);
            _gameProvider = new GameProvider(connectionString, _api, _limiter);
            IStateProvider stateProvider = new DatabaseStateProvider(connectionString);

            _privateEngine = new FlowEngine(_api, stateProvider, _limiter);
            _publicEngine  = new FlowEngine(_api, stateProvider, _limiter);

            BuildCommonFlow();
            BuildAdminFlow();
            BuildPrivateFlow();
            BuildPublicFlow();

            CheckVersion(versionNumber, versionFile);
            RunStatistic();
        }
示例#2
0
        public void TestDatabaseRelations()
        {
            var connectionString = @"Data Source=(localdb)\ProjectsV13;Initial Catalog=MafiaGMTest;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";

            DatabaseHelper.Actualize(connectionString);

            using (
                var db =
                    new DbContext(
                        connectionString)
                )
            {
                var userInTelegram = new UserInTelegram()
                {
                    Id = 2, PrivateChat = new ChatInTelegram()
                    {
                        Id = 3, LanguageIndex = 2
                    }
                };
                db.Add(userInTelegram);
                db.SaveChanges();
            }
        }