Added lazy loading and fixed private properties not deserializing

This commit is contained in:
2019-05-01 10:13:05 -05:00
parent ad26b5ef00
commit 1657510d1a
10 changed files with 28 additions and 27 deletions

View File

@@ -20,7 +20,7 @@ namespace BrightGlimmer.Domain
[JsonIgnore]
public decimal Longitude { get; private set; }
private Address() { }
protected Address() { }
public Address(string streetAddress1,
string streetAddress2,

View File

@@ -12,10 +12,10 @@ namespace BrightGlimmer.Domain
public bool IsActive { get; set; }
public string Term { get; set; }
public Student Student { get; private set; }
public Course Course { get; private set; }
public virtual Student Student { get; private set; }
public virtual Course Course { get; private set; }
private AssignedCourse() { }
protected AssignedCourse() { }
public AssignedCourse(bool isActive, string term)
{

View File

@@ -12,7 +12,7 @@ namespace BrightGlimmer.Domain
public string Description { get; set; }
public string Code { get; set; }
private Course() { }
protected Course() { }
public Course(string name, string description, string code)
{

View File

@@ -16,7 +16,7 @@ namespace BrightGlimmer.Domain
[JsonProperty]
public int Number { get; private set; }
private Phone() { }
protected Phone() { }
public Phone(PhoneType type, int areaCode, int number)
{

View File

@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
@@ -17,16 +18,16 @@ namespace BrightGlimmer.Domain
public string MiddleName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public Address Address { get; private set; }
public virtual Address Address { get; private set; }
public string ProfilePictureUrl { get; set; }
private readonly List<Phone> phones = new List<Phone>();
public IReadOnlyList<Phone> Phones => phones;
public virtual IReadOnlyList<Phone> Phones => phones;
private readonly List<AssignedCourse> assignedCourses = new List<AssignedCourse>();
public IReadOnlyList<AssignedCourse> AssignedCourses => assignedCourses;
public virtual IReadOnlyList<AssignedCourse> AssignedCourses => assignedCourses;
private Student() { }
protected Student() { }
public Student(string firstName,
string lastName,