-
Notifications
You must be signed in to change notification settings - Fork 54
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 #16 from fluentcms/basic-structure
add very basic structure
- Loading branch information
Showing
7 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
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,30 @@ | ||
namespace FluentCMS.Core.Entities | ||
{ | ||
public interface IAuditEntity<TKey> : IEntity<TKey> where TKey : IEquatable<TKey> | ||
{ | ||
string CreatedBy { get; set; } // UserName | ||
DateTime CreatedAt { get; set; } | ||
|
||
string LastUpdatedBy { get; set; } // UserName | ||
DateTime LastUpdatedAt { get; set; } | ||
} | ||
|
||
public interface IAuditEntity : IAuditEntity<Guid>, IEntity | ||
{ | ||
} | ||
|
||
public class AuditEntity<TKey> : IAuditEntity<TKey> where TKey : IEquatable<TKey> | ||
{ | ||
public TKey Id { get; set; } = default!; | ||
|
||
public string CreatedBy { get; set; } = string.Empty; // UserName | ||
public DateTime CreatedAt { get; set; } | ||
|
||
public string LastUpdatedBy { get; set; } = string.Empty; // UserName | ||
public DateTime LastUpdatedAt { get; set; } | ||
} | ||
|
||
public class AuditEntity : AuditEntity<Guid>, IAuditEntity | ||
{ | ||
} | ||
} |
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,20 @@ | ||
namespace FluentCMS.Core.Entities | ||
{ | ||
public interface IEntity<TKey> where TKey : IEquatable<TKey> | ||
{ | ||
TKey Id { get; set; } | ||
} | ||
|
||
public interface IEntity : IEntity<Guid> | ||
{ | ||
} | ||
|
||
public class Entity<TKey> : IEntity<TKey> where TKey : IEquatable<TKey> | ||
{ | ||
public TKey Id { get; set; } = default!; | ||
} | ||
|
||
public class Entity : Entity<Guid>, IEntity | ||
{ | ||
} | ||
} |
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,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
13 changes: 13 additions & 0 deletions
13
src/FluentCMS.Repository.Abstractions/FluentCMS.Repository.Abstractions.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,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\FluentCMS.Core\FluentCMS.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
24 changes: 24 additions & 0 deletions
24
src/FluentCMS.Repository.Abstractions/IGenericRepository.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,24 @@ | ||
using FluentCMS.Core.Entities; | ||
using System.Linq.Expressions; | ||
|
||
namespace FluentCMS.Repository.Abstractions | ||
{ | ||
public interface IGenericRepository<TKey, TEntity> | ||
where TKey : IEquatable<TKey> | ||
where TEntity : IEntity<TKey> | ||
{ | ||
Task Create(TEntity entity, CancellationToken cancellationToken = default); | ||
Task Update(TEntity entity, CancellationToken cancellationToken = default); | ||
Task Delete(TKey id, CancellationToken cancellationToken = default); | ||
|
||
Task<IEnumerable<TEntity>> GetAll(CancellationToken cancellationToken = default); | ||
Task<IEnumerable<TEntity>> GetAll(Expression<Func<TEntity, bool>> filter, CancellationToken cancellationToken = default); | ||
Task<TEntity> GetById(TKey id, CancellationToken cancellationToken = default); | ||
Task<IEnumerable<TEntity>> GetByIds(IEnumerable<TKey> ids, CancellationToken cancellationToken = default); | ||
} | ||
|
||
public interface IGenericRepository<TEntity> : IGenericRepository<Guid, TEntity> | ||
where TEntity : IEntity | ||
{ | ||
} | ||
} |
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,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34031.279 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCMS.Core", "FluentCMS.Core\FluentCMS.Core.csproj", "{4D5CE77A-A7C9-4B26-A9E3-0449DEB67F69}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCMS.Repository.Abstractions", "FluentCMS.Repository.Abstractions\FluentCMS.Repository.Abstractions.csproj", "{39E3BFFD-44FD-4D18-92C4-EC324438933C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{4D5CE77A-A7C9-4B26-A9E3-0449DEB67F69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4D5CE77A-A7C9-4B26-A9E3-0449DEB67F69}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4D5CE77A-A7C9-4B26-A9E3-0449DEB67F69}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4D5CE77A-A7C9-4B26-A9E3-0449DEB67F69}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{39E3BFFD-44FD-4D18-92C4-EC324438933C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{39E3BFFD-44FD-4D18-92C4-EC324438933C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{39E3BFFD-44FD-4D18-92C4-EC324438933C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{39E3BFFD-44FD-4D18-92C4-EC324438933C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {2E9F4217-7A58-48A4-9850-84CD0CDA31DA} | ||
EndGlobalSection | ||
EndGlobal |