Ejemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new AdessoRideShareContext(
                       serviceProvider.GetRequiredService <DbContextOptions <AdessoRideShareContext> >()))
            {
                #region Create Cities

                int MaxWidth = 1000, MaxLength = 500, Parcel = 50;
                int counter = 1;
                for (int i = 0; i < MaxWidth / Parcel; i++)
                {
                    for (int j = 0; j < MaxLength / Parcel; j++)
                    {
                        context.Cities.Add(new Db.Entity.City
                        {
                            Name      = $"{counter}. Şehir",
                            XLocation = i * Parcel,
                            YLocation = j * Parcel,
                            RecordId  = counter
                        });
                        counter++;
                    }
                }

                #endregion

                #region Default User
                //context.Users.Add(new Db.Entity.User
                //{
                //    RecordId = 1,
                //    Code = "test",
                //    UserName = "******",
                //    Password = "******",
                //    Name = "Samet",
                //    Surname = "Erbek"
                //});
                #endregion
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public RideRepository(AdessoRideShareContext context)
     : base(context)
 {
 }