Skip to content

Commit 5f893fe

Browse files
committed
Merge branch 'release/v.0.0.2'
2 parents e6b2380 + f4c94c3 commit 5f893fe

File tree

7 files changed

+175
-8
lines changed

7 files changed

+175
-8
lines changed

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,63 @@
11
# PH.Entities.Abstractions [![NuGet Badge](https://buildstats.info/nuget/PH.Entities.Abstractions)](https://www.nuget.org/packages/PH.Entities.Abstractions/)
22
Abstractions for Entities: simple collection of interfaces
3+
4+
## Data
5+
6+
- `IEntity` and `IEntity<TKey>`
7+
- `IDeleteableEntity` and `IDeleteableEntity<TKey>`
8+
- `INamedEntity` and `INamedEntity<TKey>`
9+
10+
11+
### Examples
12+
13+
14+
#### IEntity
15+
```csharp
16+
17+
/// <summary>
18+
/// Entity example using <see cref="IEntity{TKey}"/>
19+
/// </summary>
20+
/// <seealso cref="Guid" />
21+
public class EntitySample : IEntity<Guid>
22+
{
23+
/// <summary>
24+
/// Gets or sets the primary key identifier.
25+
/// </summary>
26+
/// <value>
27+
/// The identifier.
28+
/// </value>
29+
public Guid Id { get; set; }
30+
31+
/// <summary>
32+
/// Gets or sets a nullable date. Just for add another prop...
33+
/// </summary>
34+
/// <value>
35+
/// a nullable date.
36+
/// </value>
37+
public DateTime? ANullableDate { get; set; }
38+
}
39+
40+
```
41+
#### IDeleteableEntity
42+
```csharp
43+
44+
public class MyClass : IDeleteableEntity<long>
45+
{
46+
/// <summary>
47+
/// Gets or sets the primary key identifier.
48+
/// </summary>
49+
/// <value>
50+
/// The identifier.
51+
/// </value>
52+
public long Id { get; set; }
53+
54+
/// <summary>
55+
/// Gets or sets a value indicating whether this <see cref="IDeleteableEntity{TKey}" /> is deleted.
56+
/// </summary>
57+
/// <value>
58+
/// <c>true</c> if deleted; otherwise, <c>false</c>.
59+
/// </value>
60+
public bool Deleted { get; set; }
61+
}
62+
63+
```

src/PH.Entities.Abstractions/PH.Entities.Abstractions.sln

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.4.33205.214
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PH.Entities.Abstractions", "PH.Entities.Abstractions\PH.Entities.Abstractions.csproj", "{3D6813C4-7955-4937-B70E-8C611934A58D}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PH.Entities.Abstractions", "PH.Entities.Abstractions\PH.Entities.Abstractions.csproj", "{3D6813C4-7955-4937-B70E-8C611934A58D}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BAB3524A-3B99-41AB-AE6D-DF5EC2F1B444}"
9+
ProjectSection(SolutionItems) = preProject
10+
..\..\README.md = ..\..\README.md
11+
EndProjectSection
712
EndProject
813
Global
914
GlobalSection(SolutionConfigurationPlatforms) = preSolution

src/PH.Entities.Abstractions/PH.Entities.Abstractions/IDeleteableEntity.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ namespace PH.Entities.Abstractions
1212
/// <summary>
1313
/// Entity with <see cref="Deleted" /> property for "soft-deleting"
1414
/// </summary>
15-
/// <typeparam name="TKey">The type of the key.</typeparam>
1615
/// <seealso cref="PH.Entities.Abstractions.IEntity&lt;TKey&gt;" />
17-
public interface IDeleteableEntity<TKey> : IEntity<TKey> where TKey : IEquatable<TKey>
16+
public interface IDeleteableEntity : IEntity
1817
{
1918
/// <summary>
2019
/// Gets or sets a value indicating whether this <see cref="IDeleteableEntity{TKey}" /> is deleted.
@@ -24,4 +23,14 @@ public interface IDeleteableEntity<TKey> : IEntity<TKey> where TKey : IEquatable
2423
/// </value>
2524
bool Deleted { get; set; }
2625
}
26+
27+
/// <summary>
28+
/// Entity with <see cref="IDeleteableEntity.Deleted" /> property for "soft-deleting"
29+
/// </summary>
30+
/// <typeparam name="TKey">The type of the key.</typeparam>
31+
/// <seealso cref="PH.Entities.Abstractions.IEntity&lt;TKey&gt;" />
32+
public interface IDeleteableEntity<TKey> : IEntity<TKey> , IDeleteableEntity where TKey : IEquatable<TKey>
33+
{
34+
35+
}
2736
}

src/PH.Entities.Abstractions/PH.Entities.Abstractions/IEntity.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@
99

1010
namespace PH.Entities.Abstractions
1111
{
12+
/// <summary>
13+
/// Entity interface
14+
/// </summary>
15+
public interface IEntity
16+
{
17+
}
18+
1219
/// <summary>
1320
/// Entity with <see cref="Id" /> property as Primary Key
1421
/// </summary>
1522
/// <typeparam name="TKey">The type of the key.</typeparam>
16-
public interface IEntity<TKey> where TKey : IEquatable<TKey>
23+
public interface IEntity<TKey> : IEntity where TKey : IEquatable<TKey>
1724
{
1825
/// <summary>
1926
/// Gets or sets the primary key identifier.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
6+
namespace PH.Entities.Abstractions
7+
{
8+
/// <summary>
9+
/// Entity interface with <see cref="Name"/> property.
10+
/// </summary>
11+
/// <seealso cref="PH.Entities.Abstractions.IEntity" />
12+
public interface INamedEntity : IEntity
13+
{
14+
/// <summary>
15+
/// Gets or sets the name.
16+
/// </summary>
17+
/// <value>
18+
/// The name.
19+
/// </value>
20+
string Name { get; set; }
21+
}
22+
23+
/// <summary>
24+
/// Entity interface with <see cref="INamedEntity.Name"/> property.
25+
/// </summary>
26+
/// <typeparam name="TKey">The type of the key.</typeparam>
27+
/// <seealso cref="PH.Entities.Abstractions.IEntity" />
28+
public interface INamedEntity<TKey> : IEntity<TKey>, INamedEntity where TKey : IEquatable<TKey>
29+
{
30+
}
31+
}

src/PH.Entities.Abstractions/PH.Entities.Abstractions/PH.Entities.Abstractions.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
<PackageTags>entity,database,sql,nosql</PackageTags>
1919

20-
<PackageVersion>0.0.1</PackageVersion>
21-
<AssemblyVersion>0.0.1</AssemblyVersion>
22-
<FileVersion>0.0.1</FileVersion>
23-
<Version>0.0.1</Version>
20+
<PackageVersion>0.0.2</PackageVersion>
21+
<AssemblyVersion>0.0.2</AssemblyVersion>
22+
<FileVersion>0.0.2</FileVersion>
23+
<Version>0.0.2</Version>
2424

2525
<Authors>Paolo Innocenti</Authors>
2626
<Copyright>Copyright PH $([System.DateTime]::UtcNow.ToString("yyyy")) (c) paonath@gmail.com. All rights reserved.</Copyright>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
3+
namespace PH.Entities.Abstractions
4+
{
5+
/// <summary>
6+
/// Sample class just for write docs
7+
/// </summary>
8+
internal class Sample
9+
{
10+
/// <summary>
11+
/// Entity example using <see cref="IEntity{TKey}"/>
12+
/// </summary>
13+
/// <seealso cref="Guid" />
14+
internal class EntitySample : IEntity<Guid>
15+
{
16+
/// <summary>
17+
/// Gets or sets the primary key identifier.
18+
/// </summary>
19+
/// <value>
20+
/// The identifier.
21+
/// </value>
22+
public Guid Id { get; set; }
23+
24+
/// <summary>
25+
/// Gets or sets a nullable date. Just for add another prop...
26+
/// </summary>
27+
/// <value>
28+
/// a nullable date.
29+
/// </value>
30+
public DateTime? ANullableDate { get; set; }
31+
}
32+
33+
34+
internal class MyClass : IDeleteableEntity<long>
35+
{
36+
/// <summary>
37+
/// Gets or sets the primary key identifier.
38+
/// </summary>
39+
/// <value>
40+
/// The identifier.
41+
/// </value>
42+
public long Id { get; set; }
43+
44+
/// <summary>
45+
/// Gets or sets a value indicating whether this <see cref="IDeleteableEntity{TKey}" /> is deleted.
46+
/// </summary>
47+
/// <value>
48+
/// <c>true</c> if deleted; otherwise, <c>false</c>.
49+
/// </value>
50+
public bool Deleted { get; set; }
51+
}
52+
53+
}
54+
}

0 commit comments

Comments
 (0)