-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added msot recent version of repository from project
- Loading branch information
1 parent
f921586
commit 9f20a01
Showing
6 changed files
with
952 additions
and
0 deletions.
There are no files selected for viewing
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
10 changes: 10 additions & 0 deletions
10
...ultureCode.CSharp.Data.SqlServer/Cultures/AndcultureCode.CSharp.Data.SqlServer.en-US.json
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,10 @@ | ||
[ | ||
{ | ||
"Key": "Repository.Delete.MissingEntity", | ||
"Value": "{0} does not exist." | ||
}, | ||
{ | ||
"Key": "Repository.Delete.SoftDeletionNotIDeleteable", | ||
"Value": "In order to perform a soft delete, the object must implement the IDeletable interface." | ||
} | ||
] |
10 changes: 10 additions & 0 deletions
10
...ultureCode.CSharp.Data.SqlServer/Cultures/AndcultureCode.CSharp.Data.SqlServer.es-ES.json
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,10 @@ | ||
[ | ||
{ | ||
"Key": "Repository.Delete.MissingEntity", | ||
"Value": "{0} no existe." | ||
}, | ||
{ | ||
"Key": "Repository.Delete.SoftDeletionNotIDeleteable", | ||
"Value": "Para realizar una eliminación suave, el objeto debe implementar la interfaz IDeletable." | ||
} | ||
] |
33 changes: 33 additions & 0 deletions
33
src/AndcultureCode.CSharp.Data.SqlServer/Extensions/IEnumerableExtensions.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,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using AndcultureCode.CSharp.Extensions; | ||
|
||
namespace AndcultureCode.CSharp.Data.SqlServer.Extensions | ||
{ | ||
// TODO: Move to AndcultureCode.CSharp.Extensions | ||
public static class IEnumerableExtensions | ||
{ | ||
/// <summary> | ||
/// Returns a distinct enumerable by a specific property | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <typeparam name="TKey"></typeparam> | ||
/// <param name="source"></param> | ||
/// <param name="property"></param> | ||
/// <returns></returns> | ||
public static IEnumerable<T> DistinctBy<T, TKey>(this IEnumerable<T> source, Func<T, TKey> property) | ||
=> source.GroupBy(property).Select(x => x.First()); | ||
|
||
/// <summary> | ||
/// Returns a distinct list by a specific property | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <typeparam name="TKey"></typeparam> | ||
/// <param name="source"></param> | ||
/// <param name="property"></param> | ||
/// <returns></returns> | ||
public static IEnumerable<T> DistinctBy<T, TKey>(this List<T> source, Func<T, TKey> property) | ||
=> source.GroupBy(property).Select(x => x.First()); | ||
} | ||
} |
Oops, something went wrong.