Skip to content

Commit

Permalink
EFPT edit update
Browse files Browse the repository at this point in the history
  • Loading branch information
amos-cha committed Jul 21, 2023
1 parent dd5784c commit cccc84c
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 3 deletions.
25 changes: 23 additions & 2 deletions Gordon360/Models/CCT/Context/CCTContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public CCTContext(DbContextOptions<CCTContext> options)
public virtual DbSet<Activity> Activity { get; set; }
public virtual DbSet<ActivityStatus> ActivityStatus { get; set; }
public virtual DbSet<ActivityType> ActivityType { get; set; }
public virtual DbSet<AffiliationPoints> AffiliationPoints { get; set; }
public virtual DbSet<Affiliations> Affiliations { get; set; }
public virtual DbSet<Alumni> Alumni { get; set; }
public virtual DbSet<Birthdays> Birthdays { get; set; }
public virtual DbSet<Buildings> Buildings { get; set; }
Expand Down Expand Up @@ -101,6 +103,7 @@ public CCTContext(DbContextOptions<CCTContext> options)
public virtual DbSet<Statistic> Statistic { get; set; }
public virtual DbSet<Student> Student { get; set; }
public virtual DbSet<StudentNewsExpiration> StudentNewsExpiration { get; set; }
public virtual DbSet<SuperAdmin> SuperAdmin { get; set; }
public virtual DbSet<Surface> Surface { get; set; }
public virtual DbSet<Team> Team { get; set; }
public virtual DbSet<TeamStatus> TeamStatus { get; set; }
Expand Down Expand Up @@ -167,6 +170,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasConstraintName("FK_Activity_ActivityType");
});

modelBuilder.Entity<AffiliationPoints>(entity =>
{
entity.HasKey(e => new { e.AffiliationName, e.ActivityID });
entity.HasOne(d => d.AffiliationNameNavigation)
.WithMany(p => p.AffiliationPoints)
.HasForeignKey(d => d.AffiliationName)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_AffiliationPoints_Affiliations");
});

modelBuilder.Entity<Alumni>(entity =>
{
entity.ToView("Alumni", "dbo");
Expand Down Expand Up @@ -415,8 +429,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.PART_CDE).IsFixedLength();
entity.Property(e => e.SESS_CDE).IsFixedLength();
entity.Property(e => e.USER_NAME).IsFixedLength();
});

modelBuilder.Entity<MYSCHEDULE>(entity =>
Expand Down Expand Up @@ -747,6 +759,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.SNID).ValueGeneratedNever();
});

modelBuilder.Entity<SuperAdmin>(entity =>
{
entity.HasOne(d => d.usernameNavigation)
.WithOne(p => p.SuperAdmin)
.HasForeignKey<SuperAdmin>(d => d.username)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_SuperAdmin_Participant");
});

modelBuilder.Entity<Team>(entity =>
{
entity.HasOne(d => d.Activity)
Expand Down
14 changes: 13 additions & 1 deletion Gordon360/Models/CCT/Context/efpt.CCT.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@
"Name": "[RecIM].[ActivityType]",
"ObjectType": 0
},
{
"Name": "[RecIM].[AffiliationPoints]",
"ObjectType": 0
},
{
"Name": "[RecIM].[Affiliations]",
"ObjectType": 0
},
{
"Name": "[RecIM].[CustomParticipant]",
"ObjectType": 0
Expand Down Expand Up @@ -238,6 +246,10 @@
"Name": "[RecIM].[Statistic]",
"ObjectType": 0
},
{
"Name": "[RecIM].[SuperAdmin]",
"ObjectType": 0
},
{
"Name": "[RecIM].[Surface]",
"ObjectType": 0
Expand Down Expand Up @@ -807,7 +819,7 @@
"ObjectType": 1
}
],
"UiHint": "SQLTrain1.CCT",
"UiHint": "sqltrain1.CCT.dbo",
"UseBoolPropertiesWithoutDefaultSql": false,
"UseDatabaseNames": true,
"UseDbContextSplitting": false,
Expand Down
2 changes: 2 additions & 0 deletions Gordon360/Models/CCT/RecIM/Activity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public Activity()
[Column(TypeName = "datetime")]
public DateTime? EndDate { get; set; }
public int? SeriesScheduleID { get; set; }
public int Points { get; set; }
public int? WinnerID { get; set; }

[ForeignKey("SeriesScheduleID")]
[InverseProperty("Activity")]
Expand Down
25 changes: 25 additions & 0 deletions Gordon360/Models/CCT/RecIM/AffiliationPoints.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Gordon360.Models.CCT
{
[Table("AffiliationPoints", Schema = "RecIM")]
public partial class AffiliationPoints
{
[Key]
[StringLength(50)]
[Unicode(false)]
public string AffiliationName { get; set; }
[Key]
public int ActivityID { get; set; }

[ForeignKey("AffiliationName")]
[InverseProperty("AffiliationPoints")]
public virtual Affiliations AffiliationNameNavigation { get; set; }
}
}
27 changes: 27 additions & 0 deletions Gordon360/Models/CCT/RecIM/Affiliations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Gordon360.Models.CCT
{
[Table("Affiliations", Schema = "RecIM")]
public partial class Affiliations
{
public Affiliations()
{
AffiliationPoints = new HashSet<AffiliationPoints>();
}

[Key]
[StringLength(50)]
[Unicode(false)]
public string Name { get; set; }

[InverseProperty("AffiliationNameNavigation")]
public virtual ICollection<AffiliationPoints> AffiliationPoints { get; set; }
}
}
2 changes: 2 additions & 0 deletions Gordon360/Models/CCT/RecIM/Participant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public Participant()

[InverseProperty("UsernameNavigation")]
public virtual CustomParticipant CustomParticipant { get; set; }
[InverseProperty("usernameNavigation")]
public virtual SuperAdmin SuperAdmin { get; set; }
[InverseProperty("ParticipantUsernameNavigation")]
public virtual ICollection<MatchParticipant> MatchParticipant { get; set; }
[InverseProperty("ParticipantUsernameNavigation")]
Expand Down
1 change: 1 addition & 0 deletions Gordon360/Models/CCT/RecIM/SeriesTeam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public partial class SeriesTeam
public int SeriesID { get; set; }
public int WinCount { get; set; }
public int LossCount { get; set; }
public int TieCount { get; set; }

[ForeignKey("SeriesID")]
[InverseProperty("SeriesTeam")]
Expand Down
23 changes: 23 additions & 0 deletions Gordon360/Models/CCT/RecIM/SuperAdmin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Gordon360.Models.CCT
{
[Table("SuperAdmin", Schema = "RecIM")]
public partial class SuperAdmin
{
[Key]
[StringLength(50)]
[Unicode(false)]
public string username { get; set; }

[ForeignKey("username")]
[InverseProperty("SuperAdmin")]
public virtual Participant usernameNavigation { get; set; }
}
}
3 changes: 3 additions & 0 deletions Gordon360/Models/CCT/RecIM/Team.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public Team()
[StringLength(128)]
[Unicode(false)]
public string Logo { get; set; }
[StringLength(50)]
[Unicode(false)]
public string Affiliation { get; set; }

[ForeignKey("ActivityID")]
[InverseProperty("Team")]
Expand Down

0 comments on commit cccc84c

Please sign in to comment.