mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-25 23:04:05 +08:00
29 lines
546 B
C#
29 lines
546 B
C#
using BookingMonolith.Flight.Airports.Exceptions;
|
|
|
|
namespace BookingMonolith.Flight.Airports.ValueObjects;
|
|
|
|
public class Address
|
|
{
|
|
public string Value { get; }
|
|
|
|
private Address(string value)
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public static Address Of(string value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
{
|
|
throw new InvalidAddressException();
|
|
}
|
|
|
|
return new Address(value);
|
|
}
|
|
|
|
public static implicit operator string(Address address)
|
|
{
|
|
return address.Value;
|
|
}
|
|
}
|