Browse Source

Use IGuidGenerator for Country data seeder

pull/79/head
berkansasmaz 5 years ago
parent
commit
aa4ae53276
No known key found for this signature in database GPG Key ID: 884D815C3F32BE00
  1. 401
      src/EventHub.Domain/Data/EventHubDataSeedContributor.cs

401
src/EventHub.Domain/Data/EventHubDataSeedContributor.cs

@ -5,17 +5,21 @@ using EventHub.Countries;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
namespace EventHub.Data namespace EventHub.Data
{ {
public class EventHubDataSeedContributor : IDataSeedContributor, ITransientDependency public class EventHubDataSeedContributor : IDataSeedContributor, ITransientDependency
{ {
private readonly IRepository<Country, Guid> _countryRepository; private readonly IRepository<Country, Guid> _countryRepository;
private readonly IGuidGenerator _guidGenerator;
public EventHubDataSeedContributor( public EventHubDataSeedContributor(
IRepository<Country, Guid> countryRepository) IRepository<Country, Guid> countryRepository,
IGuidGenerator guidGenerator)
{ {
_countryRepository = countryRepository; _countryRepository = countryRepository;
_guidGenerator = guidGenerator;
} }
public async Task SeedAsync(DataSeedContext context) public async Task SeedAsync(DataSeedContext context)
@ -32,205 +36,204 @@ namespace EventHub.Data
var countries = new List<Country> var countries = new List<Country>
{ {
//TODO: Use IGuidGenerator new Country(_guidGenerator.Create(), "Afghanistan"),
new Country(Guid.NewGuid(), "Afghanistan"), new Country(_guidGenerator.Create(), "Albania"),
new Country(Guid.NewGuid(), "Albania"), new Country(_guidGenerator.Create(), "Algeria"),
new Country(Guid.NewGuid(), "Algeria"), new Country(_guidGenerator.Create(), "Andorra"),
new Country(Guid.NewGuid(), "Andorra"), new Country(_guidGenerator.Create(), "Angola"),
new Country(Guid.NewGuid(), "Angola"), new Country(_guidGenerator.Create(), "Antigua and Barbuda"),
new Country(Guid.NewGuid(), "Antigua and Barbuda"), new Country(_guidGenerator.Create(), "Argentina"),
new Country(Guid.NewGuid(), "Argentina"), new Country(_guidGenerator.Create(), "Armenia"),
new Country(Guid.NewGuid(), "Armenia"), new Country(_guidGenerator.Create(), "Australia"),
new Country(Guid.NewGuid(), "Australia"), new Country(_guidGenerator.Create(), "Austria"),
new Country(Guid.NewGuid(), "Austria"), new Country(_guidGenerator.Create(), "Azerbaijan"),
new Country(Guid.NewGuid(), "Azerbaijan"), new Country(_guidGenerator.Create(), "Bahamas"),
new Country(Guid.NewGuid(), "Bahamas"), new Country(_guidGenerator.Create(), "Bahrain"),
new Country(Guid.NewGuid(), "Bahrain"), new Country(_guidGenerator.Create(), "Bangladesh"),
new Country(Guid.NewGuid(), "Bangladesh"), new Country(_guidGenerator.Create(), "Barbados"),
new Country(Guid.NewGuid(), "Barbados"), new Country(_guidGenerator.Create(), "Belarus"),
new Country(Guid.NewGuid(), "Belarus"), new Country(_guidGenerator.Create(), "Belgium"),
new Country(Guid.NewGuid(), "Belgium"), new Country(_guidGenerator.Create(), "Belize"),
new Country(Guid.NewGuid(), "Belize"), new Country(_guidGenerator.Create(), "Benin"),
new Country(Guid.NewGuid(), "Benin"), new Country(_guidGenerator.Create(), "Bhutan"),
new Country(Guid.NewGuid(), "Bhutan"), new Country(_guidGenerator.Create(), "Bolivia"),
new Country(Guid.NewGuid(), "Bolivia"), new Country(_guidGenerator.Create(), "Bosnia and Herzegovina"),
new Country(Guid.NewGuid(), "Bosnia and Herzegovina"), new Country(_guidGenerator.Create(), "Botswana"),
new Country(Guid.NewGuid(), "Botswana"), new Country(_guidGenerator.Create(), "Brazil"),
new Country(Guid.NewGuid(), "Brazil"), new Country(_guidGenerator.Create(), "Brunei"),
new Country(Guid.NewGuid(), "Brunei"), new Country(_guidGenerator.Create(), "Bulgaria"),
new Country(Guid.NewGuid(), "Bulgaria"), new Country(_guidGenerator.Create(), "Burkina Faso"),
new Country(Guid.NewGuid(), "Burkina Faso"), new Country(_guidGenerator.Create(), "Burundi"),
new Country(Guid.NewGuid(), "Burundi"), new Country(_guidGenerator.Create(), "Côte d'Ivoire"),
new Country(Guid.NewGuid(), "Côte d'Ivoire"), new Country(_guidGenerator.Create(), "Cabo Verde"),
new Country(Guid.NewGuid(), "Cabo Verde"), new Country(_guidGenerator.Create(), "Cambodia"),
new Country(Guid.NewGuid(), "Cambodia"), new Country(_guidGenerator.Create(), "Cameroon"),
new Country(Guid.NewGuid(), "Cameroon"), new Country(_guidGenerator.Create(), "Canada"),
new Country(Guid.NewGuid(), "Canada"), new Country(_guidGenerator.Create(), "Central African Republic"),
new Country(Guid.NewGuid(), "Central African Republic"), new Country(_guidGenerator.Create(), "Chad"),
new Country(Guid.NewGuid(), "Chad"), new Country(_guidGenerator.Create(), "Chile"),
new Country(Guid.NewGuid(), "Chile"), new Country(_guidGenerator.Create(), "China"),
new Country(Guid.NewGuid(), "China"), new Country(_guidGenerator.Create(), "Colombia"),
new Country(Guid.NewGuid(), "Colombia"), new Country(_guidGenerator.Create(), "Comoros"),
new Country(Guid.NewGuid(), "Comoros"), new Country(_guidGenerator.Create(), "Congo (Congo-Brazzaville)"),
new Country(Guid.NewGuid(), "Congo (Congo-Brazzaville)"), new Country(_guidGenerator.Create(), "Costa Rica"),
new Country(Guid.NewGuid(), "Costa Rica"), new Country(_guidGenerator.Create(), "Croatia"),
new Country(Guid.NewGuid(), "Croatia"), new Country(_guidGenerator.Create(), "Cuba"),
new Country(Guid.NewGuid(), "Cuba"), new Country(_guidGenerator.Create(), "Cyprus"),
new Country(Guid.NewGuid(), "Cyprus"), new Country(_guidGenerator.Create(), "Czechia (Czech Republic)"),
new Country(Guid.NewGuid(), "Czechia (Czech Republic)"), new Country(_guidGenerator.Create(), "Democratic Republic of the Congo"),
new Country(Guid.NewGuid(), "Democratic Republic of the Congo"), new Country(_guidGenerator.Create(), "Denmark"),
new Country(Guid.NewGuid(), "Denmark"), new Country(_guidGenerator.Create(), "Djibouti"),
new Country(Guid.NewGuid(), "Djibouti"), new Country(_guidGenerator.Create(), "Dominica"),
new Country(Guid.NewGuid(), "Dominica"), new Country(_guidGenerator.Create(), "Dominican Republic"),
new Country(Guid.NewGuid(), "Dominican Republic"), new Country(_guidGenerator.Create(), "Ecuador"),
new Country(Guid.NewGuid(), "Ecuador"), new Country(_guidGenerator.Create(), "Egypt"),
new Country(Guid.NewGuid(), "Egypt"), new Country(_guidGenerator.Create(), "El Salvador"),
new Country(Guid.NewGuid(), "El Salvador"), new Country(_guidGenerator.Create(), "Equatorial Guinea"),
new Country(Guid.NewGuid(), "Equatorial Guinea"), new Country(_guidGenerator.Create(), "Eritrea"),
new Country(Guid.NewGuid(), "Eritrea"), new Country(_guidGenerator.Create(), "Estonia"),
new Country(Guid.NewGuid(), "Estonia"), new Country(_guidGenerator.Create(), "Eswatini (formerly Swaziland)"),
new Country(Guid.NewGuid(), "Eswatini (formerly Swaziland)"), new Country(_guidGenerator.Create(), "Ethiopia"),
new Country(Guid.NewGuid(), "Ethiopia"), new Country(_guidGenerator.Create(), "Fiji"),
new Country(Guid.NewGuid(), "Fiji"), new Country(_guidGenerator.Create(), "Finland"),
new Country(Guid.NewGuid(), "Finland"), new Country(_guidGenerator.Create(), "France"),
new Country(Guid.NewGuid(), "France"), new Country(_guidGenerator.Create(), "Gabon"),
new Country(Guid.NewGuid(), "Gabon"), new Country(_guidGenerator.Create(), "Gambia"),
new Country(Guid.NewGuid(), "Gambia"), new Country(_guidGenerator.Create(), "Georgia"),
new Country(Guid.NewGuid(), "Georgia"), new Country(_guidGenerator.Create(), "Germany"),
new Country(Guid.NewGuid(), "Germany"), new Country(_guidGenerator.Create(), "Ghana"),
new Country(Guid.NewGuid(), "Ghana"), new Country(_guidGenerator.Create(), "Greece"),
new Country(Guid.NewGuid(), "Greece"), new Country(_guidGenerator.Create(), "Grenada"),
new Country(Guid.NewGuid(), "Grenada"), new Country(_guidGenerator.Create(), "Guatemala"),
new Country(Guid.NewGuid(), "Guatemala"), new Country(_guidGenerator.Create(), "Guinea"),
new Country(Guid.NewGuid(), "Guinea"), new Country(_guidGenerator.Create(), "Guinea-Bissau"),
new Country(Guid.NewGuid(), "Guinea-Bissau"), new Country(_guidGenerator.Create(), "Guyana"),
new Country(Guid.NewGuid(), "Guyana"), new Country(_guidGenerator.Create(), "Haiti"),
new Country(Guid.NewGuid(), "Haiti"), new Country(_guidGenerator.Create(), "Holy See"),
new Country(Guid.NewGuid(), "Holy See"), new Country(_guidGenerator.Create(), "Honduras"),
new Country(Guid.NewGuid(), "Honduras"), new Country(_guidGenerator.Create(), "Hungary"),
new Country(Guid.NewGuid(), "Hungary"), new Country(_guidGenerator.Create(), "Iceland"),
new Country(Guid.NewGuid(), "Iceland"), new Country(_guidGenerator.Create(), "India"),
new Country(Guid.NewGuid(), "India"), new Country(_guidGenerator.Create(), "Indonesia"),
new Country(Guid.NewGuid(), "Indonesia"), new Country(_guidGenerator.Create(), "Iran"),
new Country(Guid.NewGuid(), "Iran"), new Country(_guidGenerator.Create(), "Iraq"),
new Country(Guid.NewGuid(), "Iraq"), new Country(_guidGenerator.Create(), "Ireland"),
new Country(Guid.NewGuid(), "Ireland"), new Country(_guidGenerator.Create(), "Israel"),
new Country(Guid.NewGuid(), "Israel"), new Country(_guidGenerator.Create(), "Italy"),
new Country(Guid.NewGuid(), "Italy"), new Country(_guidGenerator.Create(), "Jamaica"),
new Country(Guid.NewGuid(), "Jamaica"), new Country(_guidGenerator.Create(), "Japan"),
new Country(Guid.NewGuid(), "Japan"), new Country(_guidGenerator.Create(), "Jordan"),
new Country(Guid.NewGuid(), "Jordan"), new Country(_guidGenerator.Create(), "Kazakhstan"),
new Country(Guid.NewGuid(), "Kazakhstan"), new Country(_guidGenerator.Create(), "Kenya"),
new Country(Guid.NewGuid(), "Kenya"), new Country(_guidGenerator.Create(), "Kiribati"),
new Country(Guid.NewGuid(), "Kiribati"), new Country(_guidGenerator.Create(), "Kuwait"),
new Country(Guid.NewGuid(), "Kuwait"), new Country(_guidGenerator.Create(), "Kyrgyzstan"),
new Country(Guid.NewGuid(), "Kyrgyzstan"), new Country(_guidGenerator.Create(), "Laos"),
new Country(Guid.NewGuid(), "Laos"), new Country(_guidGenerator.Create(), "Latvia"),
new Country(Guid.NewGuid(), "Latvia"), new Country(_guidGenerator.Create(), "Lebanon"),
new Country(Guid.NewGuid(), "Lebanon"), new Country(_guidGenerator.Create(), "Lesotho"),
new Country(Guid.NewGuid(), "Lesotho"), new Country(_guidGenerator.Create(), "Liberia"),
new Country(Guid.NewGuid(), "Liberia"), new Country(_guidGenerator.Create(), "Libya"),
new Country(Guid.NewGuid(), "Libya"), new Country(_guidGenerator.Create(), "Liechtenstein"),
new Country(Guid.NewGuid(), "Liechtenstein"), new Country(_guidGenerator.Create(), "Lithuania"),
new Country(Guid.NewGuid(), "Lithuania"), new Country(_guidGenerator.Create(), "Luxembourg"),
new Country(Guid.NewGuid(), "Luxembourg"), new Country(_guidGenerator.Create(), "Madagascar"),
new Country(Guid.NewGuid(), "Madagascar"), new Country(_guidGenerator.Create(), "Malawi"),
new Country(Guid.NewGuid(), "Malawi"), new Country(_guidGenerator.Create(), "Malaysia"),
new Country(Guid.NewGuid(), "Malaysia"), new Country(_guidGenerator.Create(), "Maldives"),
new Country(Guid.NewGuid(), "Maldives"), new Country(_guidGenerator.Create(), "Mali"),
new Country(Guid.NewGuid(), "Mali"), new Country(_guidGenerator.Create(), "Malta"),
new Country(Guid.NewGuid(), "Malta"), new Country(_guidGenerator.Create(), "Marshall Islands"),
new Country(Guid.NewGuid(), "Marshall Islands"), new Country(_guidGenerator.Create(), "Mauritania"),
new Country(Guid.NewGuid(), "Mauritania"), new Country(_guidGenerator.Create(), "Mauritius"),
new Country(Guid.NewGuid(), "Mauritius"), new Country(_guidGenerator.Create(), "Mexico"),
new Country(Guid.NewGuid(), "Mexico"), new Country(_guidGenerator.Create(), "Micronesia"),
new Country(Guid.NewGuid(), "Micronesia"), new Country(_guidGenerator.Create(), "Moldova"),
new Country(Guid.NewGuid(), "Moldova"), new Country(_guidGenerator.Create(), "Monaco"),
new Country(Guid.NewGuid(), "Monaco"), new Country(_guidGenerator.Create(), "Mongolia"),
new Country(Guid.NewGuid(), "Mongolia"), new Country(_guidGenerator.Create(), "Montenegro"),
new Country(Guid.NewGuid(), "Montenegro"), new Country(_guidGenerator.Create(), "Morocco"),
new Country(Guid.NewGuid(), "Morocco"), new Country(_guidGenerator.Create(), "Mozambique"),
new Country(Guid.NewGuid(), "Mozambique"), new Country(_guidGenerator.Create(), "Myanmar (formerly Burma)"),
new Country(Guid.NewGuid(), "Myanmar (formerly Burma)"), new Country(_guidGenerator.Create(), "Namibia"),
new Country(Guid.NewGuid(), "Namibia"), new Country(_guidGenerator.Create(), "Nauru"),
new Country(Guid.NewGuid(), "Nauru"), new Country(_guidGenerator.Create(), "Nepal"),
new Country(Guid.NewGuid(), "Nepal"), new Country(_guidGenerator.Create(), "Netherlands"),
new Country(Guid.NewGuid(), "Netherlands"), new Country(_guidGenerator.Create(), "New Zealand"),
new Country(Guid.NewGuid(), "New Zealand"), new Country(_guidGenerator.Create(), "Nicaragua"),
new Country(Guid.NewGuid(), "Nicaragua"), new Country(_guidGenerator.Create(), "Niger"),
new Country(Guid.NewGuid(), "Niger"), new Country(_guidGenerator.Create(), "Nigeria"),
new Country(Guid.NewGuid(), "Nigeria"), new Country(_guidGenerator.Create(), "North Korea"),
new Country(Guid.NewGuid(), "North Korea"), new Country(_guidGenerator.Create(), "North Macedonia"),
new Country(Guid.NewGuid(), "North Macedonia"), new Country(_guidGenerator.Create(), "Norway"),
new Country(Guid.NewGuid(), "Norway"), new Country(_guidGenerator.Create(), "Oman"),
new Country(Guid.NewGuid(), "Oman"), new Country(_guidGenerator.Create(), "Pakistan"),
new Country(Guid.NewGuid(), "Pakistan"), new Country(_guidGenerator.Create(), "Palau"),
new Country(Guid.NewGuid(), "Palau"), new Country(_guidGenerator.Create(), "Palestine State"),
new Country(Guid.NewGuid(), "Palestine State"), new Country(_guidGenerator.Create(), "Panama"),
new Country(Guid.NewGuid(), "Panama"), new Country(_guidGenerator.Create(), "Papua New Guinea"),
new Country(Guid.NewGuid(), "Papua New Guinea"), new Country(_guidGenerator.Create(), "Paraguay"),
new Country(Guid.NewGuid(), "Paraguay"), new Country(_guidGenerator.Create(), "Peru"),
new Country(Guid.NewGuid(), "Peru"), new Country(_guidGenerator.Create(), "Philippines"),
new Country(Guid.NewGuid(), "Philippines"), new Country(_guidGenerator.Create(), "Poland"),
new Country(Guid.NewGuid(), "Poland"), new Country(_guidGenerator.Create(), "Portugal"),
new Country(Guid.NewGuid(), "Portugal"), new Country(_guidGenerator.Create(), "Qatar"),
new Country(Guid.NewGuid(), "Qatar"), new Country(_guidGenerator.Create(), "Romania"),
new Country(Guid.NewGuid(), "Romania"), new Country(_guidGenerator.Create(), "Russia"),
new Country(Guid.NewGuid(), "Russia"), new Country(_guidGenerator.Create(), "Rwanda"),
new Country(Guid.NewGuid(), "Rwanda"), new Country(_guidGenerator.Create(), "Saint Kitts and Nevis"),
new Country(Guid.NewGuid(), "Saint Kitts and Nevis"), new Country(_guidGenerator.Create(), "Saint Lucia"),
new Country(Guid.NewGuid(), "Saint Lucia"), new Country(_guidGenerator.Create(), "Saint Vincent and the Grenadines"),
new Country(Guid.NewGuid(), "Saint Vincent and the Grenadines"), new Country(_guidGenerator.Create(), "Samoa"),
new Country(Guid.NewGuid(), "Samoa"), new Country(_guidGenerator.Create(), "San Marino"),
new Country(Guid.NewGuid(), "San Marino"), new Country(_guidGenerator.Create(), "Sao Tome and Principe"),
new Country(Guid.NewGuid(), "Sao Tome and Principe"), new Country(_guidGenerator.Create(), "Saudi Arabia"),
new Country(Guid.NewGuid(), "Saudi Arabia"), new Country(_guidGenerator.Create(), "Senegal"),
new Country(Guid.NewGuid(), "Senegal"), new Country(_guidGenerator.Create(), "Serbia"),
new Country(Guid.NewGuid(), "Serbia"), new Country(_guidGenerator.Create(), "Seychelles"),
new Country(Guid.NewGuid(), "Seychelles"), new Country(_guidGenerator.Create(), "Sierra Leone"),
new Country(Guid.NewGuid(), "Sierra Leone"), new Country(_guidGenerator.Create(), "Singapore"),
new Country(Guid.NewGuid(), "Singapore"), new Country(_guidGenerator.Create(), "Slovakia"),
new Country(Guid.NewGuid(), "Slovakia"), new Country(_guidGenerator.Create(), "Slovenia"),
new Country(Guid.NewGuid(), "Slovenia"), new Country(_guidGenerator.Create(), "Solomon Islands"),
new Country(Guid.NewGuid(), "Solomon Islands"), new Country(_guidGenerator.Create(), "Somalia"),
new Country(Guid.NewGuid(), "Somalia"), new Country(_guidGenerator.Create(), "South Africa"),
new Country(Guid.NewGuid(), "South Africa"), new Country(_guidGenerator.Create(), "South Korea"),
new Country(Guid.NewGuid(), "South Korea"), new Country(_guidGenerator.Create(), "South Sudan"),
new Country(Guid.NewGuid(), "South Sudan"), new Country(_guidGenerator.Create(), "Spain"),
new Country(Guid.NewGuid(), "Spain"), new Country(_guidGenerator.Create(), "Sri Lanka"),
new Country(Guid.NewGuid(), "Sri Lanka"), new Country(_guidGenerator.Create(), "Sudan"),
new Country(Guid.NewGuid(), "Sudan"), new Country(_guidGenerator.Create(), "Suriname"),
new Country(Guid.NewGuid(), "Suriname"), new Country(_guidGenerator.Create(), "Sweden"),
new Country(Guid.NewGuid(), "Sweden"), new Country(_guidGenerator.Create(), "Switzerland"),
new Country(Guid.NewGuid(), "Switzerland"), new Country(_guidGenerator.Create(), "Syria"),
new Country(Guid.NewGuid(), "Syria"), new Country(_guidGenerator.Create(), "Tajikistan"),
new Country(Guid.NewGuid(), "Tajikistan"), new Country(_guidGenerator.Create(), "Tanzania"),
new Country(Guid.NewGuid(), "Tanzania"), new Country(_guidGenerator.Create(), "Thailand"),
new Country(Guid.NewGuid(), "Thailand"), new Country(_guidGenerator.Create(), "Timor-Leste"),
new Country(Guid.NewGuid(), "Timor-Leste"), new Country(_guidGenerator.Create(), "Togo"),
new Country(Guid.NewGuid(), "Togo"), new Country(_guidGenerator.Create(), "Tonga"),
new Country(Guid.NewGuid(), "Tonga"), new Country(_guidGenerator.Create(), "Trinidad and Tobago"),
new Country(Guid.NewGuid(), "Trinidad and Tobago"), new Country(_guidGenerator.Create(), "Tunisia"),
new Country(Guid.NewGuid(), "Tunisia"), new Country(_guidGenerator.Create(), "Turkey"),
new Country(Guid.NewGuid(), "Turkey"), new Country(_guidGenerator.Create(), "Turkmenistan"),
new Country(Guid.NewGuid(), "Turkmenistan"), new Country(_guidGenerator.Create(), "Tuvalu"),
new Country(Guid.NewGuid(), "Tuvalu"), new Country(_guidGenerator.Create(), "Uganda"),
new Country(Guid.NewGuid(), "Uganda"), new Country(_guidGenerator.Create(), "Ukraine"),
new Country(Guid.NewGuid(), "Ukraine"), new Country(_guidGenerator.Create(), "United Arab Emirates"),
new Country(Guid.NewGuid(), "United Arab Emirates"), new Country(_guidGenerator.Create(), "United Kingdom"),
new Country(Guid.NewGuid(), "United Kingdom"), new Country(_guidGenerator.Create(), "United States of America"),
new Country(Guid.NewGuid(), "United States of America"), new Country(_guidGenerator.Create(), "Uruguay"),
new Country(Guid.NewGuid(), "Uruguay"), new Country(_guidGenerator.Create(), "Uzbekistan"),
new Country(Guid.NewGuid(), "Uzbekistan"), new Country(_guidGenerator.Create(), "Vanuatu"),
new Country(Guid.NewGuid(), "Vanuatu"), new Country(_guidGenerator.Create(), "Venezuela"),
new Country(Guid.NewGuid(), "Venezuela"), new Country(_guidGenerator.Create(), "Vietnam"),
new Country(Guid.NewGuid(), "Vietnam"), new Country(_guidGenerator.Create(), "Yemen"),
new Country(Guid.NewGuid(), "Yemen"), new Country(_guidGenerator.Create(), "Zambia"),
new Country(Guid.NewGuid(), "Zambia"), new Country(_guidGenerator.Create(), "Zimbabwe")
new Country(Guid.NewGuid(), "Zimbabwe")
}; };
await _countryRepository.InsertManyAsync(countries, autoSave: true); await _countryRepository.InsertManyAsync(countries, autoSave: true);
} }
} }
} }

Loading…
Cancel
Save