public GeolocationDetailsManager(GeolocationContext context, ILogger logger, IIpStackConfiguration ipStackConfiguration, IGeolocationDetailsProvider geolocationDetailsProvider) { db = context; this.logger = logger; this.ipStackConfiguration = ipStackConfiguration; this.geolocationDetailsProvider = geolocationDetailsProvider; }
public GetIpDetailsHandler(IMapper mapper, IIPInfoProvider ipInfoProvider, GeolocationContext geolocationContext, ICacheProvider cacheProvider) { _mapper = mapper; _ipInfoProvider = ipInfoProvider; _geolocationContext = geolocationContext; _cacheProvider = cacheProvider; }
public static void ImportCSV(string csvFile) { var context = new GeolocationContext(); Assembly assembly = Assembly.GetExecutingAssembly(); using (var reader = new StreamReader(csvFile, Encoding.UTF8)) { CsvReader csvReader = new CsvReader(reader, CultureInfo.InvariantCulture); csvReader.Configuration.HasHeaderRecord = true; csvReader.Configuration.Delimiter = ","; csvReader.Configuration.IgnoreQuotes = true; csvReader.Configuration.RegisterClassMap <CSVMap>(); var addresses = csvReader.GetRecords <Address>().ToArray(); context.Addresses.RemoveRange(context.Addresses); context.AddRange(addresses); context.SaveChanges(); } }
public static void ImportCSV(string csvFile) { var context = new GeolocationContext(); Assembly assembly = Assembly.GetExecutingAssembly(); using (var reader = new StreamReader(csvFile, Encoding.UTF8)) { CsvReader csvReader = new CsvReader(reader, CultureInfo.InvariantCulture); csvReader.Configuration.HasHeaderRecord = true; csvReader.Configuration.Delimiter = ","; csvReader.Configuration.IgnoreQuotes = true; csvReader.Configuration.RegisterClassMap <CSVMap>(); var geolocations = csvReader.GetRecords <Geolocation>().ToArray(); context.Database.ExecuteSqlCommand("Delete from \"Geolocations\""); context.AddRange(geolocations); context.SaveChanges(); } }
public AddressesController(GeolocationContext context) { _context = context; }
public GeolocationsController(GeolocationContext context) { _context = context; }