Skip to content

Commit cea45d4

Browse files
Merge pull request #109 from Genocs/ver_600
Ver 640
2 parents 5c6d592 + 74a96fd commit cea45d4

File tree

115 files changed

+667
-622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+667
-622
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v6.4.0](https://github.com/Genocs/genocs-library/compare/v6.3.0...v6.4.0)
8+
9+
> 10 November 2024
10+
11+
- Refactor MongoDB repository structure and base classes [`98e24b1`](https://github.com/Genocs/genocs-library/commit/98e24b1aab96ca4276924a822e0b5ffec50c3e9b)
12+
- Update package references to version 6.4.0 across multiple projects [`6fdf470`](https://github.com/Genocs/genocs-library/commit/6fdf470b2234bf8a08e70deb251bef4f2cbd4edc)
13+
- Refactor: Replace IIdentifiable with IEntity [`a21e330`](https://github.com/Genocs/genocs-library/commit/a21e33004ff115b383556835096ee02bd94c9f0f)
14+
- Update packages, refactor code, and improve readability [`0a2d5be`](https://github.com/Genocs/genocs-library/commit/0a2d5be49e6e3d28e56da01aea2b72c21fa83568)
15+
- Remove project refs and add using directive [`a5f189b`](https://github.com/Genocs/genocs-library/commit/a5f189be8c47d0294ca93dea5804a11b67bcc84d)
16+
- Update to version 6.3.0 and refactor codebase [`713fb84`](https://github.com/Genocs/genocs-library/commit/713fb847400afccc205061d854db1ee22159d62d)
17+
- Standardize property names and update audit fields [`c10e995`](https://github.com/Genocs/genocs-library/commit/c10e995b229fa8958e7f0585679562c711a56c22)
18+
- Refactor MongoDB repository structure and update usings [`c3a8bac`](https://github.com/Genocs/genocs-library/commit/c3a8baca5d49ee7999be1e59384fea5c8b2d36d2)
19+
- Refactor AzureInitializer and update MongoDB.Driver [`42dfe53`](https://github.com/Genocs/genocs-library/commit/42dfe53d120dbd53fe8018bdd418f1d2d9208c0f)
20+
- Refactor null checks and exception handling [`7da092d`](https://github.com/Genocs/genocs-library/commit/7da092d0fecec393297dac85cf0a11e6fe6df95c)
21+
- Update CHANGELOG for v6.3.0 release [`2e5eb47`](https://github.com/Genocs/genocs-library/commit/2e5eb47693439d55f9974402bab3f923993f117c)
22+
- Update package versions in multiple project files [`106fc31`](https://github.com/Genocs/genocs-library/commit/106fc319c0411d90a6499bb4477b6f80cbe585f2)
23+
- Refactor Entity and IAggregateRoot for simplicity [`3ccf665`](https://github.com/Genocs/genocs-library/commit/3ccf665db0c7e8eaceb50fa13d14c1ff4faa22e6)
24+
725
#### [v6.3.0](https://github.com/Genocs/genocs-library/compare/v6.2.0...v6.3.0)
826

927
> 3 November 2024

Directory.Build.props

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project>
22

3+
<!--
4+
This Directory.Build.props files sets default properties that apply to all projects found in
5+
this folder or subfolders, recursively.
6+
-->
37
<PropertyGroup>
48
<Nullable>enable</Nullable>
59
<ImplicitUsings>enable</ImplicitUsings>
@@ -51,10 +55,12 @@
5155
</None>
5256
</ItemGroup>
5357

54-
<!--
55-
This Directory.Build.props files sets default properties that apply to all projects found in
56-
this folder or subfolders, recursively.
57-
-->
58+
<ItemGroup>
59+
<!-- Define the global DefaultIdType here. -->
60+
<Using Include="System.Guid" Alias="DefaultIdType" />
61+
</ItemGroup>
62+
63+
5864
<PropertyGroup>
5965
<!-- Enable Build Acceleration in Visual Studio. -->
6066
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>

src/Genocs.Auth/Genocs.Auth.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
</ItemGroup>
2525

2626
<ItemGroup Condition="'$(Configuration)' == 'Release'">
27-
<PackageReference Include="Genocs.Core" Version="6.3.0" />
28-
<PackageReference Include="Genocs.Security" Version="6.3.0" />
27+
<PackageReference Include="Genocs.Core" Version="6.4.0" />
28+
<PackageReference Include="Genocs.Security" Version="6.4.0" />
2929
</ItemGroup>
3030

3131
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">

src/Genocs.Common/Types/IIdentifiable.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,4 @@ public interface IIdentifiable<out T>
1010
/// The Id getter.
1111
/// </summary>
1212
T Id { get; }
13-
14-
/// <summary>
15-
/// Checks if this entity is transient (not persisted to database and it has not an <see cref="Id"/>).
16-
/// </summary>
17-
/// <returns>True, if this entity is transient, otherwise false.</returns>
18-
bool IsTransient();
1913
}

src/Genocs.Core.Demo.Contracts/Genocs.Core.Demo.Contracts.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup Condition="'$(Configuration)' == 'Release'">
14-
<PackageReference Include="Genocs.Core" Version="6.3.0" />
14+
<PackageReference Include="Genocs.Core" Version="6.4.0" />
1515
</ItemGroup>
1616

1717
</Project>
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
using Genocs.Core.Domain.Entities;
22
using Genocs.Core.Domain.Entities.Auditing;
3-
using Genocs.Persistence.MongoDb.Repositories.Clean;
3+
using Genocs.Persistence.MongoDb.Domain.Entities;
44
using MongoDB.Bson;
55

66
namespace Genocs.Core.Demo.Domain.Aggregates;
77

88
/// <summary>
99
/// Base aggregate class used for all entities.
10+
/// This class is used to define some common properties for all entities.
1011
/// </summary>
1112
public class BaseAggregate : AggregateRoot<ObjectId>, IMongoDbEntity, IHasCreationTime
1213
{
13-
public DateTime CreationTime { get; set; } = DateTime.UtcNow;
14+
public BaseAggregate()
15+
{
16+
// Set the unique identifier for the entity generates a new ObjectId.
17+
Id = ObjectId.GenerateNewId();
18+
}
19+
20+
/// <summary>
21+
/// Creation time of this entity.
22+
/// </summary>
23+
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
1424
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
using Genocs.Core.Domain.Entities;
2-
using Genocs.Core.Domain.Entities.Auditing;
3-
using Genocs.Core.Domain.Repositories;
4-
using Genocs.Persistence.MongoDb.Repositories.Clean;
1+
using Genocs.Core.Domain.Repositories;
52
using MongoDB.Bson;
63

74
namespace Genocs.Core.Demo.Domain.Aggregates;
85

96
[TableMapping("Orders")]
10-
public class Order : AggregateRoot<ObjectId>, IMongoDbEntity, IHasCreationTime
7+
public class Order : BaseAggregate
118
{
129
public Order(string orderId, string userId, decimal amount, string currency)
1310
{
@@ -19,7 +16,6 @@ public Order(string orderId, string userId, decimal amount, string currency)
1916

2017
public string OrderId { get; set; } = ObjectId.GenerateNewId().ToString();
2118
public string UserId { get; set; } = default!;
22-
public DateTime CreationTime { get; set; } = DateTime.UtcNow;
2319
public decimal Amount { get; set; }
2420
public string Currency { get; set; } = default!;
2521
}
Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,20 @@
1-
using Genocs.Common.Types;
2-
using Genocs.Core.Domain.Entities.Auditing;
3-
using Genocs.Core.Domain.Repositories;
4-
using MongoDB.Bson;
1+
using Genocs.Core.Domain.Repositories;
52

63
namespace Genocs.Core.Demo.Domain.Aggregates;
74

85
[TableMapping("Users")]
9-
public class User : IIdentifiable<ObjectId>, IHasCreationTime
6+
public class User : BaseAggregate
107
{
11-
12-
public ObjectId Id { get; set; }
138
public string UserId { get; set; } = default!;
14-
public DateTime CreationTime { get; set; } = DateTime.UtcNow;
159
public string Username { get; set; } = default!;
1610
public decimal Age { get; set; }
1711
public string Country { get; set; } = default!;
1812

1913
public User(string userId, string username, decimal age, string country)
2014
{
21-
Id = ObjectId.GenerateNewId();
2215
UserId = userId;
2316
Username = username;
2417
Age = age;
2518
Country = country;
2619
}
27-
28-
public bool IsTransient()
29-
{
30-
return true;
31-
}
3220
}

src/Genocs.Core.Demo.Domain/Genocs.Core.Demo.Domain.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
</ItemGroup>
1313

1414
<ItemGroup Condition="'$(Configuration)' == 'Release'">
15-
<PackageReference Include="Genocs.Persistence.MongoDb" Version="6.3.0" />
16-
<PackageReference Include="Genocs.Core" Version="6.3.0" />
15+
<PackageReference Include="Genocs.Persistence.MongoDb" Version="6.4.0" />
16+
<PackageReference Include="Genocs.Core" Version="6.4.0" />
1717
</ItemGroup>
1818

1919
</Project>

src/Genocs.Core.Demo.WebApi/Controllers/MongoDbController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Genocs.Core.Demo.Domain.Aggregates;
2-
using Genocs.Persistence.MongoDb.Repositories;
2+
using Genocs.Persistence.MongoDb.Domain.Repositories;
33
using Microsoft.AspNetCore.Mvc;
44

55
namespace Genocs.Core.Demo.WebApi.Controllers;

0 commit comments

Comments
 (0)