-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeatherContext.cs
More file actions
39 lines (31 loc) · 1.08 KB
/
WeatherContext.cs
File metadata and controls
39 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Diagnostics.CodeAnalysis;
using HappyCode.NetCoreBoilerplate.Core.Models;
using Microsoft.EntityFrameworkCore;
using HappyCode.NetCoreBoilerplate.Core.Dtos;
public class WeatherCollection : List<Weather>
{
public WeatherCollection(): base()
{}
}
namespace HappyCode.NetCoreBoilerplate.Core
{
[ExcludeFromCodeCoverage]
public partial class WeatherContext : DbContext
{
public WeatherContext(DbContextOptions<WeatherContext> options)
: base(options)
{}
public virtual DbSet<Weather> Weather { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasAnnotation("ProductVersion", "2.2.6-servicing-10079");
modelBuilder.Entity<Weather>(entity =>
{
entity.HasIndex(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.Property(e => e.Temperature);
entity.Property(e => e.Humidity);
});
}
}
}