-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
2,878 additions
and
123 deletions.
There are no files selected for viewing
174 changes: 76 additions & 98 deletions
174
.idea/.idea.Brighter/.idea/httpRequests/http-requests-log.http
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace GreetingsEntities | ||
{ | ||
public class Greeting | ||
{ | ||
public long Id { get; set; } | ||
public string Message { get; set; } | ||
//public Person Recipient { get; set; } | ||
public long RecipientId { get; set; } | ||
|
||
public Greeting() { /*Required by Dapperextensions*/} | ||
|
||
public Greeting(string message) | ||
{ | ||
Message = message; | ||
} | ||
|
||
public Greeting(string message, Person recipient) | ||
{ | ||
Message = message; | ||
RecipientId = recipient.Id; | ||
} | ||
|
||
public Greeting(int id, string message, Person recipient) | ||
{ | ||
Id = id; | ||
Message = message; | ||
RecipientId = recipient.Id; | ||
} | ||
|
||
public string Greet() | ||
{ | ||
return $"{Message}!"; | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
samples/WebAPI_Dapper/GreetingsEntities/GreetingsEntities.csproj
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace GreetingsEntities | ||
{ | ||
public class Person | ||
{ | ||
private readonly List<Greeting> _greetings = new List<Greeting>(); | ||
public byte[] TimeStamp { get; set; } | ||
public long Id { get; set; } | ||
public string Name { get; set; } | ||
public IEnumerable<Greeting> Greetings => _greetings; | ||
|
||
public Person(){ /*Required for DapperExtensions*/} | ||
|
||
public Person(string name) | ||
{ | ||
Name = name; | ||
} | ||
|
||
public Person(int id, string name) | ||
{ | ||
Id = id; | ||
Name = name; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
samples/WebAPI_Dapper/GreetingsPorts/EntityMappers/GreetingsMapper.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Data; | ||
using DapperExtensions.Mapper; | ||
using GreetingsEntities; | ||
|
||
namespace GreetingsPorts.EntityMappers; | ||
|
||
public class GreetingsMapper : ClassMapper<Greeting> | ||
{ | ||
public GreetingsMapper() | ||
{ | ||
TableName = nameof(Greeting); | ||
Map(g=> g.Id).Column("Id").Key(KeyType.Identity); | ||
Map(g => g.Message).Column("Message"); | ||
Map(g => g.RecipientId).Column("Recipient_Id").Key(KeyType.ForeignKey); | ||
} | ||
|
||
} | ||
|
17 changes: 17 additions & 0 deletions
17
samples/WebAPI_Dapper/GreetingsPorts/EntityMappers/PersonMapper.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using DapperExtensions.Mapper; | ||
using GreetingsEntities; | ||
|
||
namespace GreetingsPorts.EntityMappers; | ||
|
||
public class PersonMapper : ClassMapper<Person> | ||
{ | ||
public PersonMapper() | ||
{ | ||
TableName = nameof(Person); | ||
Map(p => p.Id).Column("Id").Key(KeyType.Identity); | ||
Map(p => p.Name).Column("Name"); | ||
Map(p => p.TimeStamp).Column("TimeStamp").Ignore(); | ||
Map(p => p.Greetings).Ignore(); | ||
ReferenceMap(p => p.Greetings).Reference<Greeting>((g, p) => g.RecipientId == p.Id); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
samples/WebAPI_Dapper/GreetingsPorts/GreetingsPorts.csproj
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\Paramore.Brighter.Dapper\Paramore.Brighter.Dapper.csproj" /> | ||
<ProjectReference Include="..\..\..\src\Paramore.Brighter\Paramore.Brighter.csproj" /> | ||
<ProjectReference Include="..\GreetingsEntities\GreetingsEntities.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Dapper" Version="2.0.123" /> | ||
<PackageReference Include="DapperExtensions" Version="1.7.0" /> | ||
<PackageReference Include="Paramore.Darker" Version="2.0.78" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.