私が持っていたマッピング設定TMyRowの1つのコピーを除いてすべてのプロパティは、自動プロパティです。AutoMapper強く型付けされたデータは次のように定義された
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string PositionFolder{
get {
try {
return ((string)(this[this.tableTMyDataSet.PositionFolderColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'PositionFolder\' in table \'TMyDataSet\' is DBNull.", e);
}
}
set {
this[this.tableTMyDataSet.PositionFolderColumn] = value;
}
}
私が呼ぶ:
DsMyDataSet.TMyRow row = ....;
AutoMapper.Mapper.Map<MyRowDto>(row);
列の値がnullであるので、私はStrongTypingException例外を取得します。このプロパティはnull可能ですが、厳密に型指定されたデータセットはnull可能なプロパティをサポートしていないため、IsNullableインスタンスを呼び出す必要があります。 マッピングを処理する(エラーを無視してヌル値を残す)ように、AutoMapperでこの問題を回避するにはどうすればよいですか?