-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from rena0157/updating-samples
Updating Samples
- Loading branch information
Showing
10 changed files
with
121 additions
and
120 deletions.
There are no files selected for viewing
17 changes: 8 additions & 9 deletions
17
samples/SampleMapperApp/src/SampleMapperApp.ConsoleApp/DataModels/AddressModel.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
namespace SampleMapperApp.ConsoleApp.DataModels | ||
namespace SampleMapperApp.ConsoleApp.DataModels; | ||
|
||
public class AddressModel | ||
{ | ||
public class AddressModel | ||
{ | ||
public int PersonId { get; set; } | ||
public int PersonId { get; set; } | ||
|
||
public string StreetNumber { get; set; } | ||
public string StreetNumber { get; set; } | ||
|
||
public string StreetName { get; set; } | ||
public string StreetName { get; set; } | ||
|
||
public string ZipCode { get; set; } | ||
public string ZipCode { get; set; } | ||
|
||
public string Country { get; set; } | ||
} | ||
public string Country { get; set; } | ||
} |
15 changes: 7 additions & 8 deletions
15
samples/SampleMapperApp/src/SampleMapperApp.ConsoleApp/DataModels/PersonModel.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
namespace SampleMapperApp.ConsoleApp.DataModels | ||
namespace SampleMapperApp.ConsoleApp.DataModels; | ||
|
||
public class PersonModel | ||
{ | ||
public class PersonModel | ||
{ | ||
public int Id { get; set; } | ||
public int Id { get; set; } | ||
|
||
public string FirstName { get; set; } | ||
public string FirstName { get; set; } | ||
|
||
public string LastName { get; set; } | ||
public string LastName { get; set; } | ||
|
||
public AddressModel AddressModel { get; set; } | ||
} | ||
public AddressModel AddressModel { get; set; } | ||
} |
29 changes: 14 additions & 15 deletions
29
samples/SampleMapperApp/src/SampleMapperApp.ConsoleApp/Domain/Address.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
namespace SampleMapperApp.ConsoleApp.Domain | ||
namespace SampleMapperApp.ConsoleApp.Domain; | ||
|
||
public class Address | ||
{ | ||
public class Address | ||
public Address(string streetNumber, string streetName, ZipCode zipCode, string country) | ||
{ | ||
public Address(string streetNumber, string streetName, ZipCode zipCode, string country) | ||
{ | ||
// Validation ... | ||
StreetNumber = streetNumber; | ||
StreetName = streetName; | ||
ZipCode = zipCode; | ||
Country = country; | ||
} | ||
// Validation ... | ||
StreetNumber = streetNumber; | ||
StreetName = streetName; | ||
ZipCode = zipCode; | ||
Country = country; | ||
} | ||
|
||
public string StreetNumber { get; } | ||
public string StreetNumber { get; } | ||
|
||
public string StreetName { get; } | ||
public string StreetName { get; } | ||
|
||
public ZipCode ZipCode { get; } | ||
public ZipCode ZipCode { get; } | ||
|
||
public string Country { get; } | ||
} | ||
public string Country { get; } | ||
} |
31 changes: 15 additions & 16 deletions
31
samples/SampleMapperApp/src/SampleMapperApp.ConsoleApp/Domain/Person.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
namespace SampleMapperApp.ConsoleApp.Domain | ||
namespace SampleMapperApp.ConsoleApp.Domain; | ||
|
||
public class Person | ||
{ | ||
public class Person | ||
public Person(int id, string firstName, string lastName, Address address) | ||
{ | ||
public Person(int id, string firstName, string lastName, Address address) | ||
{ | ||
// Validation... | ||
Id = id; | ||
FirstName = firstName; | ||
LastName = lastName; | ||
Address = address; | ||
} | ||
// Validation... | ||
Id = id; | ||
FirstName = firstName; | ||
LastName = lastName; | ||
Address = address; | ||
} | ||
|
||
public int Id { get; } | ||
public int Id { get; } | ||
|
||
public string FirstName { get; } | ||
public string FirstName { get; } | ||
|
||
public string LastName { get; } | ||
public string LastName { get; } | ||
|
||
public Address Address { get; } | ||
public Address Address { get; } | ||
|
||
public string FullName => $"{FirstName} {LastName}"; | ||
} | ||
public string FullName => $"{FirstName} {LastName}"; | ||
} |
17 changes: 8 additions & 9 deletions
17
samples/SampleMapperApp/src/SampleMapperApp.ConsoleApp/Domain/ZipCode.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
namespace SampleMapperApp.ConsoleApp.Domain | ||
namespace SampleMapperApp.ConsoleApp.Domain; | ||
|
||
public class ZipCode | ||
{ | ||
public class ZipCode | ||
public ZipCode(string value) | ||
{ | ||
public ZipCode(string value) | ||
{ | ||
// Validation... | ||
Value = value; | ||
} | ||
|
||
public string Value { get; } | ||
// Validation... | ||
Value = value; | ||
} | ||
|
||
public string Value { get; } | ||
} |
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
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
19 changes: 9 additions & 10 deletions
19
samples/SampleMapperApp/src/SampleMapperApp.ConsoleApp/Maps/ZipCodeMap.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
using Mapr; | ||
using SampleMapperApp.ConsoleApp.Domain; | ||
|
||
namespace SampleMapperApp.ConsoleApp.Maps | ||
namespace SampleMapperApp.ConsoleApp.Maps; | ||
|
||
public class ZipCodeMap : IMap<ZipCode, string>, IMap<string, ZipCode> | ||
{ | ||
public class ZipCodeMap : IMap<ZipCode, string>, IMap<string, ZipCode> | ||
public string Map(ZipCode source) | ||
{ | ||
public string Map(ZipCode source) | ||
{ | ||
return source.Value; | ||
} | ||
return source.Value; | ||
} | ||
|
||
public ZipCode Map(string source) | ||
{ | ||
return new(source); | ||
} | ||
public ZipCode Map(string source) | ||
{ | ||
return new(source); | ||
} | ||
} |
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
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