101 lines
3.3 KiB
C#
101 lines
3.3 KiB
C#
//------------------------------------------------------------------------------
|
|
// This is auto-generated code.
|
|
//------------------------------------------------------------------------------
|
|
// This code was generated by Entity Developer tool using EF Core template.
|
|
// Code is generated on: 10.01.2022 13:40:19
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
//------------------------------------------------------------------------------
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Data.Common;
|
|
using System.Linq;
|
|
using System.Linq.Expressions;
|
|
using System.Reflection;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Internal;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using FoodsharingSiegen.Contracts.Entity;
|
|
|
|
namespace FoodsharingSiegen.Server.Data
|
|
{
|
|
|
|
public partial class FsContext : DbContext
|
|
{
|
|
|
|
public FsContext() :
|
|
base()
|
|
{
|
|
OnCreated();
|
|
}
|
|
|
|
public FsContext(DbContextOptions<FsContext> options) :
|
|
base(options)
|
|
{
|
|
OnCreated();
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured ||
|
|
(!optionsBuilder.Options.Extensions.OfType<RelationalOptionsExtension>().Any(ext => !string.IsNullOrEmpty(ext.ConnectionString) || ext.Connection != null) &&
|
|
!optionsBuilder.Options.Extensions.Any(ext => !(ext is RelationalOptionsExtension) && !(ext is CoreOptionsExtension))))
|
|
{
|
|
}
|
|
CustomizeConfiguration(ref optionsBuilder);
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
|
|
partial void CustomizeConfiguration(ref DbContextOptionsBuilder optionsBuilder);
|
|
|
|
public virtual DbSet<User> Users
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
this.UserMapping(modelBuilder);
|
|
this.CustomizeUserMapping(modelBuilder);
|
|
|
|
RelationshipsMapping(modelBuilder);
|
|
CustomizeMapping(ref modelBuilder);
|
|
}
|
|
|
|
#region User Mapping
|
|
|
|
private void UserMapping(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<User>().ToTable(@"Users");
|
|
modelBuilder.Entity<User>().Property(x => x.Id).HasColumnName(@"Id").IsRequired().ValueGeneratedOnAdd();
|
|
modelBuilder.Entity<User>().HasKey(@"Id");
|
|
}
|
|
|
|
partial void CustomizeUserMapping(ModelBuilder modelBuilder);
|
|
|
|
#endregion
|
|
|
|
private void RelationshipsMapping(ModelBuilder modelBuilder)
|
|
{
|
|
}
|
|
|
|
partial void CustomizeMapping(ref ModelBuilder modelBuilder);
|
|
|
|
public bool HasChanges()
|
|
{
|
|
return ChangeTracker.Entries().Any(e => e.State == Microsoft.EntityFrameworkCore.EntityState.Added || e.State == Microsoft.EntityFrameworkCore.EntityState.Modified || e.State == Microsoft.EntityFrameworkCore.EntityState.Deleted);
|
|
}
|
|
|
|
partial void OnCreated();
|
|
}
|
|
}
|