Esempio n. 1
0
        internal BetManager(RestWebClient webClient)
        {
            WebClient = webClient;

            if (!webClient.IsAuthorized) {
                // Initialize a new simulated seed set
                SimulatedSeedSet = new SeedSet();
                ChangeClientSeed().Wait();

                for (var i = 2; i > 0; i--) {
                    ChangeSimulatedServerSeed();
                }
            }
        }
Esempio n. 2
0
        internal BetManager(RestWebClient webClient)
        {
            WebClient = webClient;

            if (!webClient.IsAuthorized)
            {
                // Initialize a new simulated seed set
                SimulatedSeedSet = new SeedSet();
                ChangeClientSeed().Wait();

                for (var i = 2; i > 0; i--)
                {
                    ChangeSimulatedServerSeed();
                }
            }
        }
Esempio n. 3
0
        public override void Run()
        {
            Logger.LogInformation("Seeding '{entityName}' data...", nameof(AppRole));

            var entities = new List <AppRole>
            {
                new AppRole
                {
                    Id               = (int)Roles.SystemAdministrator,
                    Name             = Roles.SystemAdministrator.ToString(),
                    NormalizedName   = Roles.SystemAdministrator.ToString().ToUpperInvariant(),
                    ConcurrencyStamp = "c211894e-6247-4d0e-92a8-5a05cd2b58d9",
                    Uid              = Guid.Parse("d8768ba2-a233-412e-8a7c-227cb4816858")
                },

                new AppRole
                {
                    Id               = (int)Roles.RegularUser,
                    Name             = Roles.RegularUser.ToString(),
                    NormalizedName   = Roles.RegularUser.ToString().ToUpperInvariant(),
                    ConcurrencyStamp = "877a5033-b5b0-4c70-af3f-74cf7b5fe433",
                    Uid              = Guid.Parse("e1a82e15-b603-47d9-b863-796d903f8db8")
                }
            };

            entities.ForEach(e =>
            {
                var dbEntity = SeedSet.AsNoTracking().SingleOrDefault(x => x.Id == e.Id);

                if (dbEntity == null)
                {
                    SeedSet.Add(e);
                }
                else
                {
                    e.ConcurrencyStamp = dbEntity.ConcurrencyStamp;
                    SeedSet.Update(e);
                }
            });

            Context.SaveChanges();
        }