Questions tagged [emitmapper]

Emit Mapper is a .NET library for mapping entities, such as objects, DataReaders or SQL commands.

Emit Mapper is an open source library written in C# to map entities to each other. It can be used to fill DTOs, DataRows or Data Access Layer entities.

Emit Mapper is hosted on CodePlex.

Example

A basic example (C#)

public class A {
    string ID { get; set; }
    int Value { get; set; }
}

public class B {
    string ID { get; set; }
    string Value { get; set; }
}

var mapper = ObjectMapperManager.DefaultInstance.GetMapper<A, B>();
B b = mapper.Map(new A { ID = "UniqueKey", Value = 8280 });

Assert.AreEqual(a.ID, b.ID);
Assert.AreEqual(Convert.ToString(a.Value), b.Value);
27 questions
1
vote
1 answer

EmitMapper with object source type

I need to use emitmapper with diffirent types. For defoult it takes two generic types: ObjectMapperManager.DefaultInstance.GetMapper().Map(source, result); I need do something like this: class Result { public string Name { set;…
Ivan Korytin
  • 1,832
  • 1
  • 27
  • 41
1
vote
0 answers

EmitMapper and ValueInjecter with IList

I'm running a performance test for AutoMapper, FasMapper, ValueInjecter and EmitMapper and I'm facing problem only with EmitMapper and ValueInjecter when I try to map list of types IList That's the code I user for all…
DAG
  • 2,460
  • 5
  • 33
  • 61
1
vote
1 answer

Emit mapper domain model to view model

Can not seem to understand how to do the following mapping, there are two models of Domain EF: public class A { public int Id {get; set;} public string Name {get; set;} } public class B { public int Id {get; set;} public string…
user2851719
1
vote
0 answers

Emitmapper Don't Map Null

Due to huge performance difference between Emitmapper and Automapper as well as an unanswered problem that i am facing with Automapper, i decided to move to Emitmapper. However i don't know what is the function in Emitmapper that is equal to…
Roman Ratskey
  • 5,101
  • 8
  • 44
  • 67
1
vote
0 answers

EmitMapper Flattering Config NullReferenceException

I am using EmitMapper with Flattering Configuration form EmitMapper samples to map my Entities to DTOs. The problem is the I am getting NullReferenceException in the case if the source value is the property of the object, which is null, for…
petrov.alex
  • 1,089
  • 2
  • 12
  • 20
1
vote
1 answer

Emit mapper. Convert object to int

I have some trouble when I try to map object to int. My classes and method where convert: [Serializable] public class ProfileProperty { public object PropertyValue { get; set; } public bool IsVisible { get; set; } public…
LuckSound
  • 986
  • 2
  • 12
  • 35
1
vote
1 answer

Emit mapper and Generic method

I have some problem with Emit mapper when I try to save in database properties. In first I mapped this class (it work good): [Serializable] public class ProfileProperty { public string PropertyValue { get; set; } public bool IsVisible {…
LuckSound
  • 986
  • 2
  • 12
  • 35
1
vote
1 answer

Emit mapper Ignoring member at mapping time

I am using Emit mapper to copy values from one object to the other. When I am mapping the objects, I need to ignore certain fields from being mapped/copied over. The fields to be ignored keeps changing based on scenario. How can this be done in…
Shreedhar Kotekar
  • 1,034
  • 10
  • 20
0
votes
1 answer

Emit Mapper Flattering with Custom Converters

With this configuration for some reason Conver function of Custom Converter is not called when using FlatteringConfig from EmitMapper Samples. It is called, when DefaultMapConfig is used. The configuration: var userMapper =…
petrov.alex
  • 1,089
  • 2
  • 12
  • 20
0
votes
1 answer

EmitMapper - Generic mapping from abstract model object to abstract DTO

I need some help transitioning from ValueInjecter to EmitMapper (I've decided so for performance reasons). My use case is one of the most common ones: mapping a Model object to a DTO, based on some rules. One of this rules is: if a property's type…
faloi
  • 391
  • 4
  • 14
0
votes
1 answer

EmitMapper (Flattened to Hierarchical)

I'd like to map from a flattened object to a hierarchical object based on a simple naming convention. For example: public class FlatObject { public string Name__FirstName { get; set; } public string Name__MiddleName { get; set; } public…
harley.333
  • 3,696
  • 2
  • 26
  • 31
0
votes
1 answer

emitmapper circular reference

emit mapper circular reference issues. I am trying to map AA to A. A has object of B, but B has object of A. This is circular reference issue. I am not sure how Emit mapper can handle this issue. public class A { public A() { list =…
Tony Bao
  • 922
  • 2
  • 12
  • 23
1
2