Auto clean code

This commit is contained in:
Sébastien André
2021-04-22 23:31:08 +02:00
parent 1c66efa4e8
commit 0d136a938a
29 changed files with 325 additions and 227 deletions

View File

@@ -3,15 +3,16 @@
using skydiveLogs_api.Domain;
using skydiveLogs_api.Infrastructure.Interfaces;
namespace skydiveLogs_api.Infrastructure
{
public class LiteDbProvider : IDataProvider
{
#region Public Constructors
public LiteDbProvider(string connectionString)
{
_db = new LiteDatabase(connectionString);
BsonMapper.Global.Entity<Jump>().DbRef(x => x.JumpType, "JumpType");
BsonMapper.Global.Entity<Jump>().DbRef(x => x.Aircraft, "Aircraft");
BsonMapper.Global.Entity<Jump>().DbRef(x => x.DropZone, "DropZone");
@@ -26,32 +27,39 @@ namespace skydiveLogs_api.Infrastructure
BsonMapper.Global.Entity<FavoriteDropZone>().DbRef(x => x.DropZone, "DropZone");
}
public ILiteCollection<T> GetCollection<T>()
{
return _db.GetCollection<T>();
}
#endregion Public Constructors
#region Public Methods
public void Close()
{
_db.Dispose();
}
private readonly LiteDatabase _db;
public ILiteCollection<T> GetCollection<T>()
{
return _db.GetCollection<T>();
}
#endregion Public Methods
#region Public Properties
public ILiteCollection<Aircraft> CollOfAircraft => _db.GetCollection<Aircraft>();
public ILiteCollection<DropZone> CollOfDropZone => _db.GetCollection<DropZone>();
public ILiteCollection<FavoriteDropZone> CollOfFavoriteDropZone => _db.GetCollection<FavoriteDropZone>();
public ILiteCollection<Gear> CollOfGear => _db.GetCollection<Gear>();
public ILiteCollection<JumpType> CollOfJumpType => _db.GetCollection<JumpType>();
public ILiteCollection<UserImage> CollOfImage => _db.GetCollection<UserImage>();
public ILiteCollection<Jump> CollOfJump => _db.GetCollection<Jump>();
public ILiteCollection<JumpType> CollOfJumpType => _db.GetCollection<JumpType>();
public ILiteCollection<User> CollOfUser => _db.GetCollection<User>();
public ILiteCollection<UserImage> CollOfImage => _db.GetCollection<UserImage>();
#endregion Public Properties
public ILiteCollection<FavoriteDropZone> CollOfFavoriteDropZone => _db.GetCollection<FavoriteDropZone>();
#region Private Fields
private readonly LiteDatabase _db;
#endregion Private Fields
}
}
}