You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When registering a custom type converter, I would expect no additional checks to be performed when validating the configuration. Instead, an exception is thrown if a type exists that cannot be automatically converted:
public class A
{
public string Foo { get; set; }
}
public class B
{
public C Foo { get; set; }
}
public class C { }
[TestMethod]
public void ConvertUsing_IgnoresProperties()
{
var config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<A, B>().ConvertUsing(x => new B { Foo = new C() });
});
config.AssertConfigurationIsValid();
}
This generates the following error:
AutoMapper.AutoMapperConfigurationException: The following property on UnitTestProject8.C cannot be mapped:
Add a custom mapping expression, ignore, add a custom resolver, or modify the destination type UnitTestProject8.C.
Context:
Mapping from type System.String to UnitTestProject8.C
Observations:
The error only occurs on properties which exist in TSrc and TDest
The error only occurs if there is no mapping between the property types
No exception is generated if trying to map using this configuration, only on AssertConfigurationIsValid
The text was updated successfully, but these errors were encountered:
When registering a custom type converter, I would expect no additional checks to be performed when validating the configuration. Instead, an exception is thrown if a type exists that cannot be automatically converted:
This generates the following error:
Observations:
The text was updated successfully, but these errors were encountered: