/// <summary> /// 加载映射配置文件 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="profile">映射配置文件</param> public static void LoadMappingProfile <TEntity>(IMappingProfile <TEntity> profile) { if (profile == null) { throw new ArgumentNullException(nameof(profile)); } profile.Configure(InternalHelper.GetExcelConfigurationMapping <TEntity>()); }
/// <summary> /// Load mapping profile for TEntity /// </summary> /// <param name="profile">profile</param> private static void LoadMappingProfile(IMappingProfile profile) { Guard.NotNull(profile, nameof(profile)); var profileInterfaceType = profile.GetType() .GetImplementedInterfaces() .FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == s_profileGenericTypeDefinition); if (profileInterfaceType is null) { return; } var entityType = profileInterfaceType.GetGenericArguments()[0]; var configuration = InternalHelper.GetExcelConfigurationMapping(entityType); var method = profileInterfaceType.GetMethod(MappingProfileConfigureMethodName, new[] { typeof(IExcelConfiguration <>).MakeGenericType(entityType) }); method?.Invoke(profile, new object[] { configuration }); }
public AdminController(IUserRepository userRepository, IMappingProfile mappingProfile) { _userRepository = userRepository; _mappingProfile = mappingProfile; }
public CustomerController(IOrderItemsRepository orderItemsRepository, IMappingProfile mappingProfile, UserManager <Customer> userManager) { _userManager = userManager; _mappingProfile = mappingProfile; _orderItemsRepository = orderItemsRepository; }
/// <summary> /// Load mapping profile for TEntity /// </summary> /// <param name="profile">profile</param> /// <typeparam name="TEntity">entity type</typeparam> public static void LoadMappingProfile <TEntity>(IMappingProfile <TEntity> profile) { Guard.NotNull(profile, nameof(profile)); profile.Configure(InternalHelper.GetExcelConfigurationMapping <TEntity>()); }