comments to startup file

This commit is contained in:
2019-05-04 17:39:10 -05:00
parent 71a178bf2f
commit 94aeabbd04
6 changed files with 228 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
using BrightGlimmer.Data;
using BrightGlimmer.Api.Domain;
using BrightGlimmer.Data;
using BrightGlimmer.Data.Interfaces;
using BrightGlimmer.Data.Repositories;
using BrightGlimmer.Domain;
@@ -26,18 +27,22 @@ namespace BrightGlimmer.Api
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
.AddJsonOptions(options =>
{
// Allow private fields to deserialize
options.SerializerSettings.ContractResolver = new PrivateSetterContractResolver();
});
/* Setup MediatR */
services.AddMediatR();
services.AddMediatR(typeof(Cqrs.Cqrs).Assembly); // Registers handlers in services project
/* Setup Injectable Repos */
services.AddTransient(typeof(IQueryRepository<>), typeof(QueryRepository<>));
services.AddTransient(typeof(ICommandRepository<>), typeof(CommandRepository<>));
/* Configure EF Core DbContext */
services.AddDbContext<BgContext>(options => options.UseLazyLoadingProxies()
.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
services.AddTransient<BgContext, BgContext>();

View File

@@ -17,7 +17,7 @@ namespace BrightGlimmer.Data
// dotnet ef migrations add NAME --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api
// dotnet ef migrations update --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api
// dotnet ef database update --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Student>(entity =>

View File

@@ -0,0 +1,193 @@
// <auto-generated />
using System;
using BrightGlimmer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace BrightGlimmer.Data.Migrations
{
[DbContext(typeof(BgContext))]
[Migration("20190504201523_Update-Database")]
partial class UpdateDatabase
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
modelBuilder.Entity("BrightGlimmer.Domain.Address", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("City");
b.Property<string>("County");
b.Property<DateTime>("CreatedDate");
b.Property<bool>("IsDeleted");
b.Property<decimal>("Latitude");
b.Property<decimal>("Longitude");
b.Property<DateTime>("ModifiedDate");
b.Property<string>("StateCode");
b.Property<string>("StreetAddress1");
b.Property<string>("StreetAddress2");
b.Property<string>("ZipCode");
b.HasKey("Id");
b.ToTable("Addresses");
});
modelBuilder.Entity("BrightGlimmer.Domain.AssignedCourse", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid?>("CourseId");
b.Property<DateTime>("CreatedDate");
b.Property<decimal?>("Grade");
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<DateTime>("ModifiedDate");
b.Property<Guid?>("StudentId");
b.Property<string>("Term");
b.HasKey("Id");
b.HasIndex("CourseId");
b.HasIndex("StudentId");
b.ToTable("AssignedCourses");
});
modelBuilder.Entity("BrightGlimmer.Domain.Course", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Code");
b.Property<DateTime>("CreatedDate");
b.Property<string>("Description");
b.Property<bool>("IsDeleted");
b.Property<DateTime>("ModifiedDate");
b.Property<string>("Name");
b.HasKey("Id");
b.ToTable("Courses");
});
modelBuilder.Entity("BrightGlimmer.Domain.Phone", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AreaCode");
b.Property<DateTime>("CreatedDate");
b.Property<bool>("IsDeleted");
b.Property<DateTime>("ModifiedDate");
b.Property<int>("Number");
b.Property<Guid?>("StudentId");
b.Property<int>("Type");
b.HasKey("Id");
b.HasIndex("StudentId");
b.ToTable("Phones");
});
modelBuilder.Entity("BrightGlimmer.Domain.Student", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid?>("AddressId");
b.Property<DateTime>("CreatedDate");
b.Property<string>("Email");
b.Property<string>("FirstName");
b.Property<bool>("IsDeleted");
b.Property<string>("LastName");
b.Property<string>("MiddleName");
b.Property<DateTime>("ModifiedDate");
b.Property<string>("ProfilePictureUrl");
b.Property<int>("StudentNumber");
b.HasKey("Id");
b.HasIndex("AddressId");
b.HasIndex("StudentNumber")
.IsUnique();
b.ToTable("Students");
});
modelBuilder.Entity("BrightGlimmer.Domain.AssignedCourse", b =>
{
b.HasOne("BrightGlimmer.Domain.Course", "Course")
.WithMany()
.HasForeignKey("CourseId");
b.HasOne("BrightGlimmer.Domain.Student", "Student")
.WithMany("AssignedCourses")
.HasForeignKey("StudentId");
});
modelBuilder.Entity("BrightGlimmer.Domain.Phone", b =>
{
b.HasOne("BrightGlimmer.Domain.Student")
.WithMany("Phones")
.HasForeignKey("StudentId");
});
modelBuilder.Entity("BrightGlimmer.Domain.Student", b =>
{
b.HasOne("BrightGlimmer.Domain.Address", "Address")
.WithMany()
.HasForeignKey("AddressId");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace BrightGlimmer.Data.Migrations
{
public partial class UpdateDatabase : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "Grade",
table: "AssignedCourses",
nullable: true,
oldClrType: typeof(decimal));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "Grade",
table: "AssignedCourses",
nullable: false,
oldClrType: typeof(decimal),
oldNullable: true);
}
}
}

View File

@@ -57,7 +57,7 @@ namespace BrightGlimmer.Data.Migrations
b.Property<DateTime>("CreatedDate");
b.Property<decimal>("Grade");
b.Property<decimal?>("Grade");
b.Property<bool>("IsActive");

Binary file not shown.