Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapper.Contrib" Version="1.60.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
using System;
using Security;
using Dapper.Contrib.Extensions;

/// <summary>
/// Base Entity class.
Expand All @@ -15,7 +14,7 @@ public class BaseEntity
/// <value>
/// The identifier.
/// </value>
public long Id { get; set; }
public uint Id { get; set; }

/// <summary>
/// Gets or sets the created at.
Expand All @@ -31,7 +30,7 @@ public class BaseEntity
/// <value>
/// The created by.
/// </value>
public long CreatedBy { get; set; }
public uint CreatedBy { get; set; }

/// <summary>
/// Gets or sets the last updated at.
Expand All @@ -47,24 +46,22 @@ public class BaseEntity
/// <value>
/// The last updated by.
/// </value>
public long? LastUpdatedBy { get; set; }
public uint? LastUpdatedBy { get; set; }

/// <summary>
/// Gets or sets the created by user.
/// </summary>
/// <value>
/// The created by user.
/// </value>
[Computed]
public virtual Users? CreatedByUser { get; set; }
public virtual User? CreatedByUser { get; set; }

/// <summary>
/// Gets or sets the last updated by user.
/// </summary>
/// <value>
/// The last updated by user.
/// </value>
[Computed]
public virtual Users? LastUpdatedByUser { get; set; }
public virtual User? LastUpdatedByUser { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ public class Page<TEntity> where TEntity : BaseEntity
/// <value>
/// The index of the page.
/// </value>
public int PageIndex { get; set; }
public uint PageIndex { get; set; }

/// <summary>
/// Gets or sets the size of the page.
/// </summary>
/// <value>
/// The size of the page.
/// </value>
public int PageSize { get; set; }
public uint PageSize { get; set; }

/// <summary>
/// Gets or sets the total items.
/// </summary>
/// <value>
/// The total items.
/// </value>
public long TotalItems { get; set; }
public uint TotalItems { get; set; }

/// <summary>
/// Gets or sets the items.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
namespace Company.Project.Domain.Entities.Security
{
using Dapper.Contrib.Extensions;
using Generics.Base;
using System.Collections.Generic;

/// <summary>
/// Action class.
/// </summary>
/// <seealso cref="Company.Project.Domain.Entities.Generics.Base.BaseEntity" />
[Table("Actions")]
public class Actions : BaseEntity
public class Activity : BaseEntity
{
/// <summary>
/// Gets or sets the name.
Expand All @@ -33,7 +31,6 @@ public class Actions : BaseEntity
/// <value>
/// The permissions.
/// </value>
[Computed]
public virtual ICollection<Permissions>? Permissions { get; set; }
public virtual ICollection<Permission>? Permissions { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
namespace Company.Project.Domain.Entities.Security
{
using Dapper.Contrib.Extensions;
using Generics.Base;

/// <summary>
/// Action class.
/// </summary>
/// <seealso cref="Company.Project.Domain.Entities.Generics.Base.BaseEntity" />
[Table("Menus")]
public class Menus : BaseEntity
public class Menu : BaseEntity
{
/// <summary>
/// Gets or sets the name.
Expand Down Expand Up @@ -40,15 +38,14 @@ public class Menus : BaseEntity
/// <value>
/// The action identifier.
/// </value>
public long ActionId { get; set; }
public uint ActionId { get; set; }

/// <summary>
/// Gets or sets the permissions.
/// </summary>
/// <value>
/// The permissions.
/// </value>
[Computed]
public virtual Actions? Action { get; set; }
public virtual Activity? Action { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
namespace Company.Project.Domain.Entities.Security
{
using Dapper.Contrib.Extensions;
using Generics.Base;

/// <summary>
/// Permission class.
/// </summary>
/// <seealso cref="Company.Project.Domain.Entities.Generics.Base.BaseEntity" />
[Table("Permissions")]
public class Permissions : BaseEntity
public class Permission : BaseEntity
{
/// <summary>
/// Gets or sets the role identifier.
/// </summary>
/// <value>
/// The role identifier.
/// </value>
public long RoleId { get; set; }
public uint RoleId { get; set; }

/// <summary>
/// Gets or sets the action identifier.
/// </summary>
/// <value>
/// The action identifier.
/// </value>
public long ActionId { get; set; }
public uint ActionId { get; set; }

/// <summary>
/// Gets or sets the roles.
/// </summary>
/// <value>
/// The roles.
/// </value>
[Computed]
public virtual Roles? Role { get; set; }
public virtual Role? Role { get; set; }

/// <summary>
/// Gets or sets the actions.
/// </summary>
/// <value>
/// The actions.
/// </value>
[Computed]
public virtual Actions? Action { get; set; }
public virtual Activity? Action { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
namespace Company.Project.Domain.Entities.Security
{
using Dapper.Contrib.Extensions;
using Generics.Base;
using System.Collections.Generic;

/// <summary>
/// Role class.
/// </summary>
/// <seealso cref="Company.Project.Domain.Entities.Generics.Base.BaseEntity" />
[Table("Roles")]
public class Roles : BaseEntity
public class Role : BaseEntity
{
/// <summary>
/// Gets or sets the name.
Expand All @@ -33,10 +31,15 @@ public class Roles : BaseEntity
/// <value>
/// The permissions.
/// </value>
[Computed]
public virtual ICollection<Permissions>? Permissions { get; set; }
public virtual ICollection<Permission>? Permissions { get; set; }

[Computed]
public virtual ICollection<Users>? Users { get; set; }

/// <summary>
/// Gets or sets the users.
/// </summary>
/// <value>
/// The users.
/// </value>
public virtual ICollection<User>? Users { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
namespace Company.Project.Domain.Entities.Security
{
using Dapper.Contrib.Extensions;
using System.ComponentModel.DataAnnotations.Schema;
using Generics.Base;

/// <summary>
/// User class.
/// </summary>
/// <seealso cref="Company.Project.Domain.Entities.Generics.Base.BaseEntity" />
[Table("Users")]
public class Users : BaseEntity
public class User : BaseEntity
{
/// <summary>
/// Gets or sets the username.
Expand Down Expand Up @@ -40,15 +39,15 @@ public class Users : BaseEntity
/// <value>
/// The role identifier.
/// </value>
public long RoleId { get; set; }
public uint RoleId { get; set; }

/// <summary>
/// Gets or sets the token.
/// </summary>
/// <value>
/// The token.
/// </value>
[Computed]
[NotMapped]
public string? Token { get; set; }

/// <summary>
Expand All @@ -57,7 +56,7 @@ public class Users : BaseEntity
/// <value>
/// The roles.
/// </value>
[Computed]
public virtual Roles? Role { get; set; }
[NotMapped]
public virtual Role? Role { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Entities.Generics.Base;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

/// <summary>
/// Base Repository interface.
Expand All @@ -16,27 +17,27 @@
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
bool Create(TEntity entity);
Task<bool> Create(TEntity entity);

/// <summary>
/// Reads all.
/// </summary>
/// <returns></returns>
IEnumerable<TEntity> Read();
Task<IEnumerable<TEntity>> Read();

/// <summary>
/// Reads by the specified filter.
/// </summary>
/// <param name="filter">The filter.</param>
/// <returns></returns>
IEnumerable<TEntity> Read(Func<TEntity, bool> filter);
Task<IEnumerable<TEntity>> Read(Expression<Func<TEntity, bool>> filter);

/// <summary>
/// Reads by the specified identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns></returns>
TEntity Read(long id);
Task<TEntity?> Read(uint id);

/// <summary>
/// Reads with paged results.
Expand All @@ -46,20 +47,20 @@
/// <param name="sortBy">The sort by.</param>
/// <param name="isAsc">if set to <c>true</c> [is asc].</param>
/// <returns></returns>
Page<TEntity> Read(int pageIndex, int pageSize, string? sortBy = null, bool isAsc = true);
Task<Page<TEntity>> Read(uint pageIndex, uint pageSize, string? sortBy = null, bool isAsc = true);

/// <summary>
/// Updates the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
bool Update(TEntity entity);
Task<bool> Update(TEntity entity);

/// <summary>
/// Deletes by the specified identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns></returns>
bool Delete(int id);
Task<bool> Delete(uint id);
}
}
Loading