Skip to content

Commit

Permalink
chore: remove BL mapper interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Pluskal committed Feb 29, 2024
1 parent c72d5b7 commit f85ad10
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace CookBook.App.ViewModels;
public partial class RecipeIngredientsEditViewModel(
IIngredientFacade ingredientFacade,
IIngredientAmountFacade ingredientAmountFacade,
IIngredientAmountModelMapper ingredientAmountModelMapper,
IngredientAmountModelMapper ingredientAmountModelMapper,
IMessengerService messengerService)
: ViewModelBase(messengerService)
{
Expand Down
4 changes: 2 additions & 2 deletions src/CookBook/CookBook.BL.Tests/FacadeTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ protected FacadeTestsBase(ITestOutputHelper output)

protected IDbContextFactory<CookBookDbContext> DbContextFactory { get; }

protected IIngredientModelMapper IngredientModelMapper { get; }
protected IngredientModelMapper IngredientModelMapper { get; }
protected IngredientAmountModelMapper IngredientAmountModelMapper { get; }
protected IRecipeModelMapper RecipeModelMapper { get; }
protected RecipeModelMapper RecipeModelMapper { get; }
protected UnitOfWorkFactory UnitOfWorkFactory { get; }

public async Task InitializeAsync()
Expand Down
4 changes: 2 additions & 2 deletions src/CookBook/CookBook.BL/BLInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public static IServiceCollection AddBLServices(this IServiceCollection services)

services.Scan(selector => selector
.FromAssemblyOf<BusinessLogic>()
.AddClasses(filter => filter.AssignableTo(typeof(ModelMapperBase<,,>)))
.AsMatchingInterface()
.AddClasses(filter => filter.AssignableTo(typeof(IModelMapper<,,>)))
.AsSelfWithInterfaces()
.WithSingletonLifetime());

return services;
Expand Down
2 changes: 1 addition & 1 deletion src/CookBook/CookBook.BL/Facades/IngredientAmountFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace CookBook.BL.Facades;

public class IngredientAmountFacade(
IUnitOfWorkFactory unitOfWorkFactory,
IIngredientAmountModelMapper ingredientAmountModelMapper)
IngredientAmountModelMapper ingredientAmountModelMapper)
:
FacadeBase<IngredientAmountEntity, IngredientAmountListModel, IngredientAmountDetailModel,
IngredientAmountEntityMapper>(unitOfWorkFactory, ingredientAmountModelMapper), IIngredientAmountFacade
Expand Down
2 changes: 1 addition & 1 deletion src/CookBook/CookBook.BL/Facades/IngredientFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace CookBook.BL.Facades;

public class IngredientFacade(
IUnitOfWorkFactory unitOfWorkFactory,
IIngredientModelMapper modelMapper)
IngredientModelMapper modelMapper)
:
FacadeBase<IngredientEntity, IngredientListModel, IngredientDetailModel, IngredientEntityMapper>(
unitOfWorkFactory, modelMapper), IIngredientFacade;
2 changes: 1 addition & 1 deletion src/CookBook/CookBook.BL/Facades/RecipeFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace CookBook.BL.Facades;

public class RecipeFacade(
IUnitOfWorkFactory unitOfWorkFactory,
IRecipeModelMapper modelMapper)
RecipeModelMapper modelMapper)
: FacadeBase<RecipeEntity, RecipeListModel, RecipeDetailModel, RecipeEntityMapper>(unitOfWorkFactory, modelMapper),
IRecipeFacade
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
namespace CookBook.BL.Mappers;

public class IngredientAmountModelMapper :
ModelMapperBase<IngredientAmountEntity, IngredientAmountListModel, IngredientAmountDetailModel>,
IIngredientAmountModelMapper
ModelMapperBase<IngredientAmountEntity, IngredientAmountListModel, IngredientAmountDetailModel>
{
public override IngredientAmountListModel MapToListModel(IngredientAmountEntity? entity)
=> entity?.Ingredient is null
Expand Down
3 changes: 1 addition & 2 deletions src/CookBook/CookBook.BL/Mappers/IngredientModelMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

namespace CookBook.BL.Mappers;

public class IngredientModelMapper : ModelMapperBase<IngredientEntity, IngredientListModel, IngredientDetailModel>,
IIngredientModelMapper
public class IngredientModelMapper : ModelMapperBase<IngredientEntity, IngredientListModel, IngredientDetailModel>
{
public override IngredientListModel MapToListModel(IngredientEntity? entity)
=> entity is null
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions src/CookBook/CookBook.BL/Mappers/ModelMapperBase.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace CookBook.BL.Mappers;

public abstract class
ModelMapperBase<TEntity, TListModel, TDetailModel> : IModelMapper<TEntity, TListModel, TDetailModel>
public abstract class ModelMapperBase<TEntity, TListModel, TDetailModel> : IModelMapper<TEntity, TListModel, TDetailModel>
{
public abstract TListModel MapToListModel(TEntity? entity);

Expand Down
4 changes: 2 additions & 2 deletions src/CookBook/CookBook.BL/Mappers/RecipeModelMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

namespace CookBook.BL.Mappers;

public class RecipeModelMapper(IIngredientAmountModelMapper ingredientAmountModelMapper)
: ModelMapperBase<RecipeEntity, RecipeListModel, RecipeDetailModel>, IRecipeModelMapper
public class RecipeModelMapper(IngredientAmountModelMapper ingredientAmountModelMapper)
: ModelMapperBase<RecipeEntity, RecipeListModel, RecipeDetailModel>
{
public override RecipeListModel MapToListModel(RecipeEntity? entity)
=> entity is null
Expand Down

0 comments on commit f85ad10

Please sign in to comment.