Example #1
0
 private static void Library(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Library>().HasData(
         new
     {
         UserId             = 1,
         GameId             = 1,
         DateAcquired       = DateTime.SpecifyKind(new DateTime(2019, 7, 20), DateTimeKind.Utc),
         TotalPlayTimeHours = 20,
         LastPlayedDate     = DateTime.UtcNow,
         CreatedAt          = DateTime.UtcNow,
         IsDeleted          = false
     },
         new
     {
         UserId             = 1,
         GameId             = 2,
         DateAcquired       = DateTime.UtcNow,
         TotalPlayTimeHours = 0,
         LastPlayedDate     = new DateTime(),
         CreatedAt          = DateTime.UtcNow,
         IsDeleted          = false
     },
         new
     {
         UserId             = 2,
         GameId             = 1,
         DateAcquired       = DateTime.SpecifyKind(new DateTime(2019, 7, 18), DateTimeKind.Utc),
         TotalPlayTimeHours = (int)(DateTime.UtcNow - DateTime.SpecifyKind(new DateTime(2019, 7, 19), DateTimeKind.Utc)).TotalHours,
         LastPlayedDate     = DateTime.UtcNow,
         CreatedAt          = DateTime.UtcNow,
         IsDeleted          = false
     }
         );
 }
Example #2
0
        // METHODS
        public void Seed(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            #region Bills
            Bill bill1 = new Bill {
                Id = 1, PaymentStatus = Enums.PaymentStatus.Paid
            };

            Bill bill2 = new Bill {
                Id = 2, PaymentStatus = Enums.PaymentStatus.PaidWithDelay
            };

            Bill bill3 = new Bill {
                Id = 3, PaymentStatus = Enums.PaymentStatus.WaitingForPayment
            };
            Bill bill4 = new Bill {
                Id = 4, PaymentStatus = Enums.PaymentStatus.WaitingForPayment
            };
            Bill bill5 = new Bill {
                Id = 5, PaymentStatus = Enums.PaymentStatus.WaitingForPayment
            };

            Bill bill6 = new Bill {
                Id = 6, PaymentStatus = Enums.PaymentStatus.Overdue
            };
            #endregion

            #region Seed
            modelBuilder.Entity <Bill>().HasData(bill1, bill2, bill3, bill4, bill5, bill6);
            #endregion
        }
Example #3
0
        // METHODS
        public void Seed(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            #region Apartments
            Apartment apartment1 = new Apartment {
                Id = 1, MainPhoto = "photo1.png", Name = "A1", Description = "A1", Price = 100
            };
            Apartment apartment2 = new Apartment {
                Id = 2, MainPhoto = "photo2.png", Name = "A2", Description = "A2", Price = 100
            };

            Apartment apartment3 = new Apartment {
                Id = 3, MainPhoto = "photo3.png", Name = "A3", Description = "A3", Price = 200
            };
            Apartment apartment4 = new Apartment {
                Id = 4, MainPhoto = "photo4.png", Name = "A4", Description = "A4", Price = 200
            };
            Apartment apartment5 = new Apartment {
                Id = 5, MainPhoto = "photo5.png", Name = "A5", Description = "A5", Price = 200
            };
            #endregion

            #region Seed
            modelBuilder.Entity <Apartment>().HasData(apartment1, apartment2, apartment3, apartment4, apartment5);
            #endregion
        }
Example #4
0
 private static void Company(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Company>().HasData(
         new
     {
         Id           = 1,
         Name         = "Methesda Softworks Inc.",
         HomepageUri  = "https://www.methesda-softworks.com",
         Description  = "We make really cool games!",
         LogoImageUri = "https://cdn.notsteam.com/images/101",
         CreatedAt    = DateTime.UtcNow,
         IsDeleted    = false
     },
         new
     {
         Id           = 2,
         Name         = "CryMeARiverTek GmbH",
         HomepageUri  = "https://www.crymearivertek.com",
         Description  = "We make tech demos!",
         LogoImageUri = "https://cdn.notsteam.com/images/102",
         CreatedAt    = DateTime.UtcNow,
         IsDeleted    = false
     },
         new
     {
         Id           = 3,
         Name         = "DVD Projekt Blue",
         HomepageUri  = "https://www.dvd-projekt-blue.com",
         Description  = "We make great action-adventure, role-playing games!",
         LogoImageUri = "https://cdn.notsteam.com/images/103",
         CreatedAt    = DateTime.UtcNow,
         IsDeleted    = false
     }
         );
 }
Example #5
0
 private static void Tag(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Tag>().HasData(
         new
     {
         Id          = 1,
         Name        = "Single-Player",
         Description = "This item contains single-player content (e.g. campaign, story mode, etc.)",
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     },
         new
     {
         Id          = 2,
         Name        = "Multi-Player",
         Description = "This item contains multi-player content. Requires an internet connection.",
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     },
         new
     {
         Id          = 3,
         Name        = "Co-Op",
         Description = "This item contains ce-op content. Requires an internet connection. A limited amount of players can group up and play!",
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     }
         );
 }
Example #6
0
 private static void Review(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Review>().HasData(
         new
     {
         UserId      = 1,
         GameId      = 1,
         Rating      = 8,
         Description = "This is a really good game! You should get it too!",
         DateCreated = DateTime.UtcNow,
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     },
         new
     {
         UserId      = 2,
         GameId      = 1,
         Rating      = 6,
         Description = "It's a good game, but I don't like \"surprise mechanics\".",
         DateCreated = DateTime.SpecifyKind(new DateTime(2019, 7, 20), DateTimeKind.Utc),
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     }
         );;
 }
Example #7
0
 private static void Purchase(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Purchase>().HasData(
         new
     {
         UserId         = 1,
         GameId         = 1,
         DateOfPurchase = DateTime.SpecifyKind(new DateTime(2019, 7, 19), DateTimeKind.Utc),
         TotalPrice     = 59.99M,
         CreatedAt      = DateTime.UtcNow,
         IsDeleted      = false
     },
         new
     {
         UserId         = 1,
         GameId         = 2,
         DateOfPurchase = DateTime.SpecifyKind(new DateTime(2019, 7, 10), DateTimeKind.Utc),
         TotalPrice     = 64.99M,
         CreatedAt      = DateTime.UtcNow,
         IsDeleted      = false
     },
         new
     {
         UserId         = 2,
         GameId         = 1,
         DateOfPurchase = DateTime.SpecifyKind(new DateTime(2019, 7, 1), DateTimeKind.Utc),
         TotalPrice     = 24.99M,
         CreatedAt      = DateTime.UtcNow,
         IsDeleted      = false
     }
         );
 }
Example #8
0
        public static Microsoft.EntityFrameworkCore.ModelBuilder ApplyIdentitySeed(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            modelBuilder.Entity <Role>().HasData(
                new Role
            {
                Id               = 1,
                Name             = Constants.Roles.Admin,
                NormalizedName   = Constants.Roles.Admin.ToUpper(),
                ConcurrencyStamp = Guid.NewGuid().ToString("D")
            },
                new Role
            {
                Id               = 2,
                Name             = Constants.Roles.User,
                NormalizedName   = Constants.Roles.User.ToUpper(),
                ConcurrencyStamp = Guid.NewGuid().ToString("D")
            },
                new Role
            {
                Id               = 3,
                Name             = Constants.Roles.Tenant,
                NormalizedName   = Constants.Roles.Tenant.ToUpper(),
                ConcurrencyStamp = Guid.NewGuid().ToString("D")
            });

            return(modelBuilder);
        }
Example #9
0
        public static void AddAuditableShadowProperties
            (this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            foreach (var entityType in modelBuilder.Model
                     .GetEntityTypes()
                     .Where(e => typeof(Models.AuditableEntity.IAuditableEntity).IsAssignableFrom(e.ClrType)))
            {
                modelBuilder.Entity(entityType.ClrType)
                .Property <string>(CreatedByBrowserName).HasMaxLength(1000);

                modelBuilder.Entity(entityType.ClrType)
                .Property <string>(ModifiedByBrowserName).HasMaxLength(1000);

                modelBuilder.Entity(entityType.ClrType)
                .Property <string>(CreatedByIp).HasMaxLength(255);

                modelBuilder.Entity(entityType.ClrType)
                .Property <string>(ModifiedByIp).HasMaxLength(255);

                modelBuilder.Entity(entityType.ClrType)
                .Property <int?>(CreatedByUserId);

                modelBuilder.Entity(entityType.ClrType)
                .Property <int?>(ModifiedByUserId);

                modelBuilder.Entity(entityType.ClrType)
                .Property <System.DateTimeOffset?>(CreatedDateTime);

                modelBuilder.Entity(entityType.ClrType)
                .Property <System.DateTimeOffset?>(ModifiedDateTime);
            }
        }
 /// <summary>
 /// Adds the generated join definitions.
 /// </summary>
 /// <param name="modelBuilder">The model builder.</param>
 protected void AddJoinDefinitions(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Account>().HasMany(entity => entity.JoinedUnlockedCharacterClasses).WithOne(join => join.Account);
     modelBuilder.Entity <AccountCharacterClass>().HasKey(join => new { join.AccountId, join.CharacterClassId });
     modelBuilder.Entity <Character>().HasMany(entity => entity.JoinedDropItemGroups).WithOne(join => join.Character);
     modelBuilder.Entity <CharacterDropItemGroup>().HasKey(join => new { join.CharacterId, join.DropItemGroupId });
     modelBuilder.Entity <Item>().HasMany(entity => entity.JoinedItemSetGroups).WithOne(join => join.Item);
     modelBuilder.Entity <ItemItemSetGroup>().HasKey(join => new { join.ItemId, join.ItemSetGroupId });
     modelBuilder.Entity <ItemAppearance>().HasMany(entity => entity.JoinedVisibleOptions).WithOne(join => join.ItemAppearance);
     modelBuilder.Entity <ItemAppearanceItemOptionType>().HasKey(join => new { join.ItemAppearanceId, join.ItemOptionTypeId });
     modelBuilder.Entity <DropItemGroup>().HasMany(entity => entity.JoinedPossibleItems).WithOne(join => join.DropItemGroup);
     modelBuilder.Entity <DropItemGroupItemDefinition>().HasKey(join => new { join.DropItemGroupId, join.ItemDefinitionId });
     modelBuilder.Entity <GameMapDefinition>().HasMany(entity => entity.JoinedDropItemGroups).WithOne(join => join.GameMapDefinition);
     modelBuilder.Entity <GameMapDefinitionDropItemGroup>().HasKey(join => new { join.GameMapDefinitionId, join.DropItemGroupId });
     modelBuilder.Entity <GameServerConfiguration>().HasMany(entity => entity.JoinedMaps).WithOne(join => join.GameServerConfiguration);
     modelBuilder.Entity <GameServerConfigurationGameMapDefinition>().HasKey(join => new { join.GameServerConfigurationId, join.GameMapDefinitionId });
     modelBuilder.Entity <MasterSkillDefinition>().HasMany(entity => entity.JoinedRequiredMasterSkills).WithOne(join => join.MasterSkillDefinition);
     modelBuilder.Entity <MasterSkillDefinitionSkill>().HasKey(join => new { join.MasterSkillDefinitionId, join.SkillId });
     modelBuilder.Entity <MonsterDefinition>().HasMany(entity => entity.JoinedDropItemGroups).WithOne(join => join.MonsterDefinition);
     modelBuilder.Entity <MonsterDefinitionDropItemGroup>().HasKey(join => new { join.MonsterDefinitionId, join.DropItemGroupId });
     modelBuilder.Entity <Skill>().HasMany(entity => entity.JoinedQualifiedCharacters).WithOne(join => join.Skill);
     modelBuilder.Entity <SkillCharacterClass>().HasKey(join => new { join.SkillId, join.CharacterClassId });
     modelBuilder.Entity <ItemDefinition>().HasMany(entity => entity.JoinedQualifiedCharacters).WithOne(join => join.ItemDefinition);
     modelBuilder.Entity <ItemDefinitionCharacterClass>().HasKey(join => new { join.ItemDefinitionId, join.CharacterClassId });
     modelBuilder.Entity <ItemDefinition>().HasMany(entity => entity.JoinedPossibleItemSetGroups).WithOne(join => join.ItemDefinition);
     modelBuilder.Entity <ItemDefinitionItemSetGroup>().HasKey(join => new { join.ItemDefinitionId, join.ItemSetGroupId });
     modelBuilder.Entity <ItemDefinition>().HasMany(entity => entity.JoinedPossibleItemOptions).WithOne(join => join.ItemDefinition);
     modelBuilder.Entity <ItemDefinitionItemOptionDefinition>().HasKey(join => new { join.ItemDefinitionId, join.ItemOptionDefinitionId });
     modelBuilder.Entity <ItemCraftingRequiredItem>().HasMany(entity => entity.JoinedPossibleItems).WithOne(join => join.ItemCraftingRequiredItem);
     modelBuilder.Entity <ItemCraftingRequiredItemItemDefinition>().HasKey(join => new { join.ItemCraftingRequiredItemId, join.ItemDefinitionId });
     modelBuilder.Entity <ItemCraftingRequiredItem>().HasMany(entity => entity.JoinedRequiredItemOptions).WithOne(join => join.ItemCraftingRequiredItem);
     modelBuilder.Entity <ItemCraftingRequiredItemItemOptionType>().HasKey(join => new { join.ItemCraftingRequiredItemId, join.ItemOptionTypeId });
 }
Example #11
0
        // METHODS
        public void Seed(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            #region Users
            User user1 = new User {
                Id = 1, FirstName = "John", LastName = "Doe", Email = "*****@*****.**", Password = "******", Role = Enums.Role.Administrator
            };

            User user2 = new User {
                Id = 2, FirstName = "Jane", LastName = "Doe", Email = "*****@*****.**", Password = "******", Role = Enums.Role.Manager
            };
            User user3 = new User {
                Id = 3, FirstName = "Kayson", LastName = "Swim", Email = "*****@*****.**", Password = "******", Role = Enums.Role.Manager
            };                                                                                                                                                       // no renters

            User user4 = new User {
                Id = 4, FirstName = "Clementine", LastName = "Oil", Email = "*****@*****.**", Password = "******", Role = Enums.Role.Resident
            };
            User user5 = new User {
                Id = 5, FirstName = "Beverley", LastName = "Boo", Email = "*****@*****.**", Password = "******", Role = Enums.Role.Resident
            };
            User user6 = new User {
                Id = 6, FirstName = "Harold", LastName = "Man", Email = "*****@*****.**", Password = "******", Role = Enums.Role.Resident
            };
            User user7 = new User {
                Id = 7, FirstName = "Abigail", LastName = "Spencer", Email = "*****@*****.**", Password = "******", Role = Enums.Role.Resident
            };

            user4.ManagerId = user2.Id;
            user5.ManagerId = user2.Id;
            #endregion

            #region Seed
            modelBuilder.Entity <User>().HasData(user1, user2, user3, user4, user5, user6, user7);
            #endregion
        }
        // METHODS
        public void Seed(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            #region Notification
            Notification notification1 = new Notification()
            {
                Id = 1, EmergencyLevel = Enums.EmergencyLevel.Info, Description = "Notification 1"
            };
            Notification notification2 = new Notification()
            {
                Id = 2, EmergencyLevel = Enums.EmergencyLevel.Info, Description = "Notification 2"
            };

            Notification notification3 = new Notification()
            {
                Id = 3, EmergencyLevel = Enums.EmergencyLevel.Success, Description = "Notification 3"
            };

            Notification notification4 = new Notification()
            {
                Id = 4, EmergencyLevel = Enums.EmergencyLevel.Warning, Description = "Notification 4"
            };

            Notification notification5 = new Notification()
            {
                Id = 5, EmergencyLevel = Enums.EmergencyLevel.Danger, Description = "Notification 5"
            };
            #endregion

            #region Seed
            modelBuilder.Entity <Notification>().HasData(notification1, notification2, notification3, notification4, notification5);
            #endregion
        }
Example #13
0
 private static void SetupQueryFilter <TEntity>(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
     where TEntity : BaseModel
 {
     if (typeof(BaseModel).GetTypeInfo().IsAssignableFrom(typeof(TEntity).Ge‌​tTypeInfo()))
     {
         modelBuilder.Entity <TEntity>().HasQueryFilter(temp => !temp.IsDeleted);
     }
 }
Example #14
0
 public static void SoftDeleteSetup(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     SetupQueryFilter <City>(modelBuilder);
     SetupQueryFilter <NoticeBoard>(modelBuilder);
     SetupQueryFilter <Country>(modelBuilder);
     SetupQueryFilter <QuizTheme>(modelBuilder);
     SetupQueryFilter <Champion>(modelBuilder);
 }
Example #15
0
 /// <summary>
 /// Configures the client context.
 /// </summary>
 /// <param name="modelBuilder">The model builder.</param>
 public static void ConfigureFreteContext(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Frete>(e =>
     {
         e.HasKey(k => k.Id);
         e.HasIndex(k => k.Modalidade).IsUnique();
         e.Property(p => p.Descricao).HasMaxLength(1000);
     });
 }
Example #16
0
 public static void SoftDeleteSetup(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     SetupQueryFilter <Agency>(modelBuilder);
     SetupQueryFilter <Booking>(modelBuilder);
     // SetupQueryFilter<Guest>(modelBuilder);
     SetupQueryFilter <Hotel>(modelBuilder);
     SetupQueryFilter <Payment>(modelBuilder);
     SetupQueryFilter <Room>(modelBuilder);
 }
 internal static void SetEntityQueryFilter <TEntityInterface>(
     this Microsoft.EntityFrameworkCore.ModelBuilder builder,
     Type entityType,
     Expression <Func <TEntityInterface, bool> > filterExpression)
 {
     SetQueryFilterMethod
     .MakeGenericMethod(entityType, typeof(TEntityInterface))
     .Invoke(null, new object[] { builder, filterExpression });
 }
Example #18
0
        private static void User(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            modelBuilder.Entity <Teacher>()
            .HasIndex(p => new { p.FirstName, p.LastName })
            .IsUnique(true);

            modelBuilder.Entity <Student>()
            .HasIndex(p => new { p.FirstName, p.LastName })
            .IsUnique(true);
        }
Example #19
0
 public static void Seed(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     User(modelBuilder);
     Company(modelBuilder);
     Tag(modelBuilder);
     Game(modelBuilder);
     GameTag(modelBuilder);
     Library(modelBuilder);
     Purchase(modelBuilder);
     Review(modelBuilder);
 }
        static void SetQueryFilter <TEntity, TEntityInterface>(
            this Microsoft.EntityFrameworkCore.ModelBuilder builder,
            Expression <Func <TEntityInterface, bool> > filterExpression)
            where TEntityInterface : class
            where TEntity : class, TEntityInterface
        {
            var concreteExpression = filterExpression
                                     .Convert <TEntityInterface, TEntity>();

            builder.Entity <TEntity>()
            .HasQueryFilter(concreteExpression);
        }
Example #21
0
        public static void SoftDeleteSetup(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            SetupQueryFilter <City>(modelBuilder);
            SetupQueryFilter <College>(modelBuilder);
            SetupQueryFilter <Country>(modelBuilder);
            SetupQueryFilter <Course>(modelBuilder);

            SetupQueryFilter <Division>(modelBuilder);
            SetupQueryFilter <Executor>(modelBuilder);
            SetupQueryFilter <Grade>(modelBuilder);
            SetupQueryFilter <Student>(modelBuilder);
            SetupQueryFilter <Teacher>(modelBuilder);
        }
Example #22
0
 private static void GameTag(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <GameTag>().HasData(
         new
     {
         GameId    = 1,
         TagId     = 1,
         CreatedAt = DateTime.UtcNow,
         IsDeleted = false
     },
         new
     {
         GameId    = 1,
         TagId     = 2,
         CreatedAt = DateTime.UtcNow,
         IsDeleted = false
     },
         new
     {
         GameId    = 2,
         TagId     = 1,
         CreatedAt = DateTime.UtcNow,
         IsDeleted = false
     },
         new
     {
         GameId    = 2,
         TagId     = 2,
         CreatedAt = DateTime.UtcNow,
         IsDeleted = false
     },
         new
     {
         GameId    = 2,
         TagId     = 3,
         CreatedAt = DateTime.UtcNow,
         IsDeleted = false
     },
         new
     {
         GameId    = 3,
         TagId     = 1,
         CreatedAt = DateTime.UtcNow,
         IsDeleted = false
     }
         );
 }
Example #23
0
 private static void User(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <User>().HasData(
         new
     {
         Id              = 1,
         Username        = "******",
         Password        = "******",
         Email           = "*****@*****.**",
         DateOfBirth     = DateTime.SpecifyKind(new DateTime(1996, 4, 23), DateTimeKind.Utc),
         Nickname        = "xXSlayerXx",
         ProfileImageUri = "https://cdn.notsteam.com/images/1",
         CreatedAt       = DateTime.UtcNow,
         IsDeleted       = false
     },
         new
     {
         Id              = 2,
         Username        = "******",
         Password        = "******",
         Email           = "*****@*****.**",
         DateOfBirth     = DateTime.SpecifyKind(new DateTime(1992, 2, 12), DateTimeKind.Utc),
         Nickname        = "Sgt. Harry",
         ProfileImageUri = "https://cdn.notsteam.com/images/2",
         CreatedAt       = DateTime.UtcNow,
         IsDeleted       = false
     },
         new
     {
         Id              = 3,
         Username        = "******",
         Password        = "******",
         Email           = "*****@*****.**",
         DateOfBirth     = DateTime.SpecifyKind(new DateTime(1989, 8, 30), DateTimeKind.Utc),
         Nickname        = "Mr.Boom",
         ProfileImageUri = "https://cdn.notsteam.com/images/3",
         CreatedAt       = DateTime.UtcNow,
         IsDeleted       = false
     }
         );
 }
Example #24
0
 private static void Game(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Game>().HasData(
         new
     {
         Id          = 1,
         Title       = "C4ll of $$$$: Covert Ops",
         Description = "New year, new game!",
         ReleaseDate = DateTime.SpecifyKind(new DateTime(2019, 6, 22), DateTimeKind.Utc),
         BasePrice   = 59.99M,
         CompanyId   = 3,
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     },
         new
     {
         Id          = 2,
         Title       = "Need for Speed: Underground 3",
         Description = "What we really want from EA.",
         ReleaseDate = DateTime.SpecifyKind(new DateTime(2018, 12, 12), DateTimeKind.Utc),
         BasePrice   = 79.99M,
         CompanyId   = 1,
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     },
         new
     {
         Id          = 3,
         Title       = "Age of Empires 4",
         Description = "One of these days…",
         ReleaseDate = DateTime.SpecifyKind(new DateTime(2022, 10, 10), DateTimeKind.Utc),
         BasePrice   = 69.69M,
         CompanyId   = 2,
         CreatedAt   = DateTime.UtcNow,
         IsDeleted   = false
     }
         );
 }
 public static void Seed(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     modelBuilder.Entity <Product>().HasData(
         new Product
     {
         Id               = 101,
         Name             = "Body Cream",
         Group            = GroupType.Cosmetics,
         Price            = 20.00M,
         ShortDescription = "Nice to the skin.",
         LongDescription  = "You will love it, plus it brighten your skin."
     },
         new Product
     {
         Id               = 102,
         Name             = "Chin-Chin",
         Group            = GroupType.Food,
         Price            = 5.00M,
         ShortDescription = " Very nice and sweet.",
         LongDescription  = "You will love to eat it all day long."
     }
         );
 }
        private void AddUsers(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            User administrator = new User()
            {
                Id        = 1,
                FirstName = "Admin",
                LastName  = "Admin",
                Email     = "*****@*****.**",
                Password  = "******",
                Role      = Enums.Role.Administrator,
            };

            User manager = new User()
            {
                Id        = 2,
                FirstName = "Manager",
                LastName  = "Manager",
                Email     = "*****@*****.**",
                Password  = "******",
                Role      = Enums.Role.Manager,
            };

            modelBuilder.Entity <User>().HasData(administrator, manager);
        }
        // **********

        protected override void OnModelCreating
            (Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }
Example #28
0
 public static void ValidationSetup(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     User(modelBuilder);
 }
Example #29
0
 private static void User(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     //modelBuilder.Entity<Teacher>()
     //   .HasIndex(p => new { p.FirstName, p.LastName, p.Address })
     // .IsUnique(true);
 }
 public void Seed(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
 {
     // TODO: seed data
 }