I am trying to overload a Generic method with a specific method. But he is not going to the specifiek typed method, he takes the generic method that will not be implemented.
public static class Functions<TE, TC, TG>
where TE : Entity, IExternalConexioEntity
where TC : class, IInternalConexioEntity, IObjectState
where TG : ConexioEntity
{
public static TG ConvertToEntity(TC conexioEntity)
{
throw new Exception("Type not supported(" + conexioEntity.GetType() + ")");
}
public static Contact ConvertToEntity(ConexioContact synccontact)
{
}
}
The method call:
result.Add(ConvertEntity(synchronizationContact));
And the syncrhonizationContact is also a generic type where TC : class, IInternalConexioEntity, IObjectState
. So the actual type is ConexioContact.
But he is not running to the second method and my value is of type ConexioContact.
Conexio.Data.Entities.Conexio.ConexioContact
System.AggregateException: One or more errors occurred. ---> System.Exception: Type not supported(Conexio.Data.Entities.Conexio.ConexioContact)
at Conexio.Core.Orchestration.Functions`3.ConvertToEntity(TC conexioEntity) in
d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Functions.cs:line 187
at Conexio.Core.Orchestration.Contacts.Doubtfuls.SearchDoubtfuls`3.ConvertEntity(TC entity) in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Contacts\Doubtfuls\SearchDoubtfuls.cs:line 107
at Conexio.Core.Orchestration.Contacts.Doubtfuls.SearchDoubtfuls`3.<SearchAsync>d__5.MoveNext() in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Contacts\Doubtfuls\SearchDoubtfuls.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Conexio.Core.Orchestration.Contacts.ConexioEntityBL`3.<SearchDoubtfulsAsync>d__28.MoveNext() in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Contacts\ConexioEntityBL.cs:line 323
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Conexio.Core.Orchestration.Test.Doubtfuls.SearchContactsTest.TestSearch4() in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration.Matching.Test\Doubtfuls\SearchContactsTest.cs:line 90
---> (Inner Exception #0) System.Exception: Type not supported(Conexio.Data.Entities.Conexio.ConexioContact)
at Conexio.Core.Orchestration.Functions`3.ConvertToEntity(TC conexioEntity) in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Functions.cs:line 187
at Conexio.Core.Orchestration.Contacts.Doubtfuls.SearchDoubtfuls`3.ConvertEntity(TC entity) in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Contacts\Doubtfuls\SearchDoubtfuls.cs:line 107
at Conexio.Core.Orchestration.Contacts.Doubtfuls.SearchDoubtfuls`3.<SearchAsync>d__5.MoveNext() in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Contacts\Doubtfuls\SearchDoubtfuls.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Conexio.Core.Orchestration.Contacts.ConexioEntityBL`3.<SearchDoubtfulsAsync>d__28.MoveNext() in d:\TeamFoundation\Sources\Conexio\Conexio.Core.Orchestration\Contacts\ConexioEntityBL.cs:line 323<---