lundi 21 août 2017

Error in dynamic mapping: Missing type mapping or unsupported mapping

I have a data data something like this:

Public class Columns
{
Public String ColumnSource {get; set;}
Public public string TargetDb {get; set;}
Public DbType Type {get; set;}
}

Public class Table
{
Public string Name {get; set;}
Public IList <Column> Columns {get; set;}
}


Var DictionariesData = new Table ();

I use the System.Reflection.Emit.TypeBuilder class to generate a type at run time.

Use Dapper to get the data without a database and generate a variable with the type of the table, for example:

Var result = connection.Query (typeof (classGerada), "select * from Table");

Now I'd like to do a mapping from classGenerated to ClassGenerated2, one difference of the two is once for two columns and all things as columns.

I'm trying to do this to use AutoMapper (it's not like doing in another library, I accept suggestion). I am using the following mapping:

AutoMapper.Mapper.Initialize (f => f.CreateMap (targetClass, sourceClass)
.ForMember ("Sequential", m => m.MapFrom ("TableId")));

When I run

Var resultMap = Mapper.Map (result, sourceClass);

I have the following error:

Map configuration of missing type or mapping not supported.

Mapping types: IEnumerable1 -> Type System.Collections.Generic.IEnumerable1 [[System.Object, mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089]] -> System.Type

*sourceClass is the type generated at runtime from the data dictionary.

Does anyone know what's wrong? Or what would one do?





Aucun commentaire:

Enregistrer un commentaire