using FoodsharingSiegen.Contracts.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace FoodsharingSiegen.Server.Data
{
///
/// The fs context class (a. beging, 21.05.2022)
///
///
public sealed class FsContext : DbContext
{
#region Public Properties
///
/// Gets or sets the value of the interactions (ab)
///
public DbSet? Interactions { get; set; }
///
/// Gets or sets the value of the prospects (ab)
///
public DbSet? Prospects { get; set; }
///
/// Gets or sets the value of the users (ab)
///
public DbSet? Users { get; set; }
#endregion
#region Setup/Teardown
///
/// Initializes a new instance of the class
///
/// The options (ab)
public FsContext(DbContextOptions options) : base(options)
{
Database.EnsureCreated();
}
#endregion
#region Public Method HasChanges
///
/// Describes whether this instance has changes
///
/// The bool
public bool HasChanges()
{
return ChangeTracker.Entries().Any(e => e.State is EntityState.Added or EntityState.Modified or EntityState.Deleted);
}
#endregion
}
}