我很努力地映射2个对象。基本上有产品,这是我的EF模型,我将它映射到具有FileDto的ProductDto。 我想将Product.FileName映射到ProductDto.File.Internal名称,如何做到这一点? 下面的类。 public class Product : BaseEntity<long>
{
[MaxLength(100)]
public
我使用AutoMapper将ViewModel映射到模型。但是,如果相应的源属性为null,我希望属性不会映射。 我的源类如下: public class Source
{
//Other fields...
public string Id { get; set; } //This should not be mapped if null
}
和目的地类是: publ
我可以看到,AutoMapper支持Open Generics和Inheritance,但我无法让它与这两者结合使用。 鉴于 public class Foo
{
public int Id { get; set; }
}
public class Bar<T> : Foo
{
public T Value { get; set; }
}
,并假设互补类的Foo