Beispiel #1
0
        private static void ExecuteTranslationInitializers(DatabaseContext context)
        {
            var listTranslationInitializers = new List <BaseTranslationInitializer>
            {
                new SignInTranslationInitializer(),
                new MainMenuTranslationInitializer(),
                new GeneralTranslationInitializer(),
                new RoleTranslationInitializer(),
                new UserTranslationInitializer(),
                new AdminTranslationInitializer()
            };

            TranslationInitializer.SeedTranslations(context, listTranslationInitializers);
        }
Beispiel #2
0
        public IQueryable <TEntity> Seed()
        {
            if (AllowSeedMetaData)
            {
                var entities        = SeedMetaData();
                var updatedEntities = new List <TEntity>();

                foreach (var entity in entities)
                {
                    updatedEntities.Add(TranslationInitializer.SeedEntityTranslations(
                                            Context,
                                            Expression,
                                            KeyExpression,
                                            entity));
                }

                Context.AddOrUpdateRange(
                    Expression,
                    KeyExpression,
                    updatedEntities);
            }

            if (AllowSeedTestData)
            {
                var entities        = SeedTestData();
                var updatedEntities = new List <TEntity>();

                foreach (var entity in entities)
                {
                    updatedEntities.Add(TranslationInitializer.SeedEntityTranslations(
                                            Context,
                                            Expression,
                                            KeyExpression,
                                            entity));
                }

                Context.AddOrUpdateRange(
                    Expression,
                    KeyExpression,
                    updatedEntities);
            }

            Context.SaveChanges();

            return(Context.Set <TEntity>());
        }