This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Student : Entity | |
{ | |
public virtual string Name { get; set; } | |
public virtual decimal TotalDebt { get; set; } | |
public virtual IList<Enrollment> Enrollments { get; set; } | |
public virtual IList<SportsActivity> SportsActivities { get; set; } | |
} | |
public class Enrollment : Entity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PlanningTool | |
{ | |
internal int Id { get; private set; } | |
// Rest of class | |
public ICollection<PlanningToolTab> Tabs { get; private set; } | |
} | |
public class PlanningToolTab | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeService | |
{ | |
public void FirePeriodicJob() | |
{ | |
/* Runs asynchronously */ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StatisticsCalculator | |
{ | |
public async Task<(double weightDelivered, double totalCost)> Calculate(int customerId) | |
{ | |
List<DeliveryRecord> records = await GetDeliveries(customerId); | |
double weightDelivered = records.Sum(x => x.Weight); | |
double totalCost = records.Sum(x => x.Cost); | |
return (weightDelivered, totalCost); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderRepository | |
{ | |
public void Save(Order order) | |
{ | |
/* ... */ | |
} | |
public Order GetById(long id) | |
{ | |
/* ... */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AllowanceAmount : ValueObject | |
{ | |
public const int MaxLength = 50; | |
public string Value { get; } | |
private AllowanceAmount(string value) | |
{ | |
Value = value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer | |
{ | |
public string Name { get; set; } | |
public string Email { get; set; } | |
} | |
Customer customer = GetCustomer(); | |
customer.Name = customer.Email; // Compiles perfectly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Calculator | |
{ | |
public static int Add(int value1, int value2) | |
{ | |
return value1 + value2; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct Email | |
{ | |
public string Value { get; } | |
public bool IsConfirmed { get; } | |
public Email(string value, bool isConfirmed) | |
{ | |
Value = value; | |
IsConfirmed = isConfirmed; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer | |
{ | |
private CustomerStatus _status = CustomerStatus.Regular; | |
public void Promote() | |
{ | |
_status = CustomerStatus.Preferred; | |
} | |
public decimal GetDiscount() |