50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using FoodsharingSiegen.Contracts.Entity;
|
|
using FoodsharingSiegen.Server.Auth;
|
|
|
|
namespace FoodsharingSiegen.Server.Data.Service
|
|
{
|
|
/// <summary>
|
|
/// The service base class (a. beging, 23.05.2022)
|
|
/// </summary>
|
|
public class ServiceBase
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Gets the value of the auth service (ab)
|
|
/// </summary>
|
|
public AuthService AuthService { get; }
|
|
|
|
#endregion
|
|
|
|
#region Setup/Teardown
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
/// <summary> Specialised constructor for use only by derived class. </summary>
|
|
///
|
|
/// <remarks> A Beging, 20.10.2021. </remarks>
|
|
///
|
|
/// <param name="context"> The context. </param>
|
|
/// <param name="authService"></param>
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
protected ServiceBase(FsContext context, AuthService authService)
|
|
{
|
|
Context = context;
|
|
AuthService = authService;
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// Gets the value of the current user (ab)
|
|
/// </summary>
|
|
protected User? CurrentUser => AuthService.User;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
/// <summary> Database Context </summary>
|
|
///
|
|
/// <value> The context. </value>
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
protected FsContext Context { get; }
|
|
}
|
|
} |