Questions tagged [valueinjecter]

ValueInjecter lets you define your own convention-based matching algorithms (ValueInjections) in order to match up (inject) source values to destination values.

ValueInjecter lets you define your own convention-based matching algorithms (ValueInjections) in order to match up (inject) source values to destination values.

Source code: https://github.com/omuleanu/ValueInjecter

151 questions
0
votes
1 answer

Map null using ValueInjecter

How do I map a null to an object using valueinjecter? It throws an error when I do this. Do I need to use something else other than InjectFrom()? more info I have a repository that returns an object domain. I then want to map this domain to a…
Shawn Mclean
  • 56,733
  • 95
  • 279
  • 406
0
votes
1 answer

Using Omu.ValueInjecter to map peroperties of different types

We are currently in the process of upgrading one of the parts of our system. We are wanting to run both parts of the system at the same time so we can test that its working correctly. To Achieve this we are using Omu.ValueInjecter.Map method to…
Keithin8a
  • 961
  • 7
  • 32
0
votes
2 answers

How to map enums using Value Injector

I am trying to get my hands on ValueInjector having used Automapper in the past. I want to convert one enum to another where only the enum names are different but the property name and values are same. public enum GenderModel { …
Afraz Ali
  • 2,672
  • 2
  • 27
  • 47
0
votes
0 answers

Deep clone - InjectFrom - ValueInjecter - parameter count mismatch

I am trying to do a deep clone of tagsusing ValueInjecter Here is the code. IList processTags = new List(); processTags.InjectFrom(tags); The second line throws parameter count mismatch Why is it so and how do I overcome it?
Gopi
  • 5,656
  • 22
  • 80
  • 146
0
votes
1 answer

ValueInjecter custom mapping doesn't work on custom properties

I have this code: Mapper.AddMap(src => { var res = new DetailsVM(); res.InjectFrom(src); // maps properties with same name and type res.test = "asd"; return res; }); …
Carlos Miguel Colanta
  • 2,685
  • 3
  • 31
  • 49
0
votes
0 answers

Injecting derived classes

I have a problem using ValueInjecter for derived classes: public class A { public Guid Id { get; set; } public string Name { get; set; } } public class B : A { public int Age { get; set; } } public static void main() { var b = new B() …
nttakr
  • 1,637
  • 15
  • 25
0
votes
0 answers

ValueInjecter map complex types

I am attempting to map these complex types using ValueInjecter but the mapped object all of the properties are null. DTO public class HardwareSettingsDto { public HardwareSettingsDto() { EmailAlertSettings = new…
Jamie Rees
  • 7,973
  • 2
  • 45
  • 83
0
votes
1 answer

Cloning or injecting a class and its subclass properties to another (From source to target)

I am struggling to inject a class and its subclass properties from source to target. For instance, I am getting objects like below from the return value of a method. I need to inject it into a target type. Class A { prop A prop B } Class B :…
Jasmine
  • 5,186
  • 16
  • 62
  • 114
0
votes
0 answers

getting an Exception in VB.net while injecting target with source using Value Injector

I am getting this exception. "Public member InjectFrom on type ApplicationObj_B not found." I figured out the reason for this. This is because, I am checking if the source property type is value or array only. However, my source property type is an…
Jasmine
  • 5,186
  • 16
  • 62
  • 114
0
votes
0 answers

Valueinjecter map base derived class

I have a base class Ad. public class Ad { public int Id{get;set;} public string Title{get;set;} public string Price{get;set;} } Then I have a lot of derived classes like: public class CarAd : Ad { public string ModelName…
Usman Khalid
  • 3,032
  • 9
  • 41
  • 66
0
votes
1 answer

ValueInjecter : Inject child property independently into destination

Consider I have the below classes: class Destination { public int Id { get; set; } public Child MyChild { get; set; } } class Child { public string Name { get; set; } } In my Main() method: Child MyChild = new Child() { Name = "Tom"…
Lucifer
  • 2,317
  • 9
  • 43
  • 67
0
votes
1 answer

How to do these mappings by using valueInjecter instead of AutoMapper

I have used Automapper in one of my project before, now I want to use ValueInjecter for the other one. These are ViewModels public class ApplicantListViewModel : BaseViewModel { public int Id {get; set;} public string Name {get;set;} …
Barış Velioğlu
  • 5,709
  • 15
  • 59
  • 105
0
votes
1 answer

Omu.ValueInjecter: can I map values to an existing object?

I've been using Omu.ValueInjecter for a while now but only to 'inject' values into a newly created object. public K MapNew(T source) { K target = new K(); target.InjectFrom(source); return target; } The code above…
Daniel Hollinrake
  • 1,768
  • 2
  • 19
  • 39
0
votes
1 answer

System.ArgumentException in valueinjecter when mapping same objects

I have a class: public class LotInfo { public string lotn { get; set; } public string imlitm { get; set; } public string imdsc { get; set; } public string wplotn { get; set; } public int wptrdj { get; set;…
e4rthdog
  • 5,103
  • 4
  • 40
  • 89
0
votes
1 answer

Mapping Data Entity with Self-Navigating Property to Business Entity

I'm having a lot of trouble with creating my business entities from my data entities. Github My Data.Entities.User looks as follows: public class User { public User() { Messages = new List(); Followers = new…
Bio2hazard
  • 150
  • 3
  • 10