﻿using System.Data.Entity;
using HelloWorld.Data.EntityFramework.Configuration;
using HelloWorld.Domain.Entities;

namespace HelloWorld.Data.EntityFramework
{
    public class HelloWorldDbContext : DbContext
    {
        public HelloWorldDbContext()
            : base("HelloWorldConnectionString")
        {
        }

        public IDbSet<User> Users { get; set; }
        public IDbSet<Role> Roles { get; set; }
        public IDbSet<Place> Places { get; set; }
        public IDbSet<City> Cities { get; set; }
        public IDbSet<Country> Countries { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new UserConfiguration());
            modelBuilder.Configurations.Add(new RoleConfiguration());
            modelBuilder.Configurations.Add(new PlaceConfiguration());
            modelBuilder.Configurations.Add(new CityConfiguration());
            modelBuilder.Configurations.Add(new CountryConfiguration());
        }
    }
}