| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- using Quadarax.Foundation.Core.Data.Interface.Entity;
- using Quadarax.Foundation.Core.Mapper;
- namespace Quadarax.Foundation.Core.Data.Mapper
- {
- public class Mapper<TMapper> : Loom where TMapper : class, new()
- {
- /// <summary>
- /// Singleton instance of this class.
- /// </summary>
- public static TMapper Instance => _instance.Value;
- private static readonly Lazy<TMapper> _instance = new Lazy<TMapper>(() => new TMapper());
- #region ------ Constructors ---------------------------------------------------------------
- /// <summary>
- /// Initializes a new instance of this class.
- /// </summary>
- public Mapper()
- {
-
- }
- /// <summary>
- /// Defines mappings from a DAO to DTO and vice-versa.
- /// </summary>
- /// <typeparam name="TDao"></typeparam>
- /// <typeparam name="TDto"></typeparam>
- protected void DefineBiDirection<TDao, TDto, TKey>()
- where TDao : class, IDao<TKey>, new()
- where TDto : class, IDto, new()
- where TKey : IEquatable<TKey>
- {
- Define<TDao, TDto>()
- .PublicProperties()
- .Compile();
- Define<TDto, TDao>()
- .PublicProperties()
- .Compile();
- }
- #endregion
- }
- }
|