AutoMapper how to map a CamelCase Dictionary<string, object> to a PascalCase C# object
问题 I'm trying to map a Dictionary<string, object> where properties are keyed with Camel casing to a C# object with Pascal casing: var id = Guid.NewGuid(); var dto = new Dictionary<string, object> { { "id", id.ToString() }, { "value", "some value" }, }; var mapper = new MapperConfiguration(cfg => { }).CreateMapper(); var result = mapper.Map<TestClass>(dto); var expected = new TestClass { Id = id, Value = "some value", }; result.Should().BeEquivalentTo(expected); If I put the dictionary keys as