Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ilka Kistinger
bee-weather
Commits
b9095f86
Commit
b9095f86
authored
Mar 12, 2020
by
Anthony Mochel
Browse files
fix(log): disposable context
parent
b8e53fc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
BeeWeatherPollenTracker/Program.cs
View file @
b9095f86
...
...
@@ -75,17 +75,7 @@ namespace BeeWeatherPollenTracker
catch
(
Exception
e
)
{
logs
.
WriteInFile
(
e
);
if
(
string
.
IsNullOrEmpty
(
pollenJson
))
{
try
{
File
.
WriteAllText
(
$"pollen_
{
DateTime
.
Now
.
ToString
()}
.json"
,
pollenJson
);
}
catch
(
Exception
inner
)
{
logs
.
WriteInFile
(
inner
);
}
}
logs
.
WriteBackup
(
LoggerManager
.
DataForcastType
.
POLL
,
pollenJson
);
}
#
endregion
Pollen
...
...
BeeWeatherPollenTracker/WeatherForecast.cs
View file @
b9095f86
...
...
@@ -88,14 +88,17 @@ namespace BeeWeatherPollenTracker
try
{
// Entity context
var
context
=
new
delmeEntities1
();
// Add weather forecast to context
foreach
(
var
item
in
this
.
_weather_forecast_list
)
context
.
beehive_weather_forecast
.
Add
(
item
);
// Push data in databse
context
.
SaveChanges
();
using
(
var
context
=
new
delmeEntities1
())
{
// Add weather forecast to context
foreach
(
var
item
in
this
.
_weather_forecast_list
)
context
.
beehive_weather_forecast
.
Add
(
item
);
// Push data in databse
context
.
SaveChanges
();
}
}
catch
(
Exception
ex
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment