Automapper は初めてです。
Nuget パッケージ - Automapper をマネージャー (BLL) と DAL レイヤーに追加しました。
さて、以下は関連するものです:
以下は、私に例外を与える Manager ライブラリのステートメントです。
this.dataRepository.Update(Mapper.Map<StudentMaster>(studentDTO));
例外は次のとおりです。
タイプ マップ構成が欠落しているか、サポートされていないマッピングです。
マッピング タイプ:
studentDTO -> StudentMaster
Admin.App.DTO.studentDTO-> Admin.App.DAL.StudentMaster
EF での select/where クエリの場合、機能しており、次を使用してマップできます
.Project().To<TReturn>()
Autoconfiguration.cs
私は次のようにファイルを書きました:
public static class AutoMapperConfiguration
{
public static void Configure()
{
ConfigureStudentMasterMaps();
}
private static void ConfigureStudentMasterMaps()
{
Mapper.CreateMap<StudentMaster, studentDTO>();
}
}
ノート:
両方のエンティティ - StudentMaster
(モデル) エンティティとStudentDTO
同じプロパティがあります。
この問題を解決する方法を教えてください。
ありがとうございました