Interface implemented class mappings generates proxy types
See original GitHub issuepublic interface IMyInterface
{
int MyProperty { get; set; }
}
public class ImplementedClass : IMyInterface
{
public int MyProperty
{
get;
set;
}
}
public class MyClass
{
public int MyProperty { get; set; }
}
class Program
{
static void Main(string[] args)
{
Mapper.CreateMap<MyClass, IMyInterface>();
Mapper.AssertConfigurationIsValid();
var myClassInstance = new MyClass { MyProperty = 3 };
var obj = Mapper.Map(myClassInstance, typeof(MyClass), typeof(ImplementedClass));
Debug.Assert(!obj.GetType().Assembly.IsDynamic);
}
}
This generates Automapper’s interface proxy class types but I think it should create ImplementedClass 's instance.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Java Mapping for Interfaces - Ice
Proxy objects implement the java.io.Serializable interface that enables serialization of proxies to and from a byte stream. You can use the standard class...
Read more >java - Getting implemented interfaces from the proxy
Should I memorize interface classes along with the proxy list or there is a way to map proxy to its implementing interfaces, likewise...
Read more >Java Mapping for Interfaces - Ice
Java Classes Generated for an Interface. The compiler generates quite a few source ... This source file defines the helper type for the...
Read more >Auto-generating implementation of interface (proxy without ...
1 Answer. So after some research and trial & error i've found out, that the Unity. Interception does not support proxies of interfaces...
Read more >Proxy (Java Platform SE 8 )
Each proxy class has one public constructor that takes one argument, an implementation of the interface InvocationHandler , to set the invocation handler...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This isn’t configured properly. In order to achieve this (remember AutoMapper has no idea about
ImplementedClass
) You have two options:MyClass
->ImplementedClass
and include the base usingIncludeBase
IMyInterface
mapping to construct yourImplementedClass
,.ConstructUsing
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.