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
1
vote
1 answer

Open DataReader when mapping from EF 4.1 code first and ValueInjecter

I am using Entity Framework 4.1 code first with ASP.NET MVC 3 and Razor view and ValueInjecter. My view model: public class ProductViewModel { public int Id { get; set; } public string SKU { get; set; } public string Name { get; set;…
Brendan Vogt
  • 25,678
  • 37
  • 146
  • 234
1
vote
1 answer

Custom Value Injection

I have question about how to inject value with no source property defined. so I have 2 class : User.cs public class User { public int UserId { get; set; } public string UserName { get; set; } } and UserViewModel.cs public class…
Rivera
  • 69
  • 1
  • 2
  • 8
1
vote
1 answer

Moving from legacy to ValueInjecter

We had a custom object extension method that would handle the following. Source is DataRow target is class. Source is DataTable target is a List Source is class target is class Source is List target is List I found…
Razcer
  • 394
  • 4
  • 17
1
vote
1 answer

Mapping Composite Object using Reflection and ValueInjecter

Maybe this question, always asked in this forum, but I don't find the one that I need. My problem is I have a composite class like this class Customer { private int Id { set; get; } private int Name { set; get; } private Company Company {…
Willy
  • 1,689
  • 7
  • 36
  • 79
1
vote
1 answer

Rule based Merging of list elements into list in C#

I have a list. Based on some properties of object of type A, I want to merge one or more object of type A from the list and form a new object of type B. Merging will be based on some predefined rules. something like automapper, but input is a list…
Ramveer Singh
  • 39
  • 1
  • 5
1
vote
0 answers

ValueInjecter: what to replace ConventionInjection with?

Older versions of ValueInjecter had a ConventionInjection class; however that seems to have been removed even in the oldest version supported by .NET Core, so I can't switch my project to .NET Core without rewriting the code that uses…
ekolis
  • 6,270
  • 12
  • 50
  • 101
1
vote
1 answer

Flatten Domain Class To ViewModel When Source Is Complex

I am using ValueInjecter to map domain classes to my view models. My domain classes are complex. To borrow an example from this question: public class Person { public int Id { get; set; } public string FirstName { get; set; } public…
Louise Eggleton
  • 969
  • 2
  • 15
  • 27
1
vote
1 answer

ValueInjecter - recursive mapping

I'm pretty new to auto-mapping, and even newer to ValueInjecter. I'm sorry if this is an easy question, but I can't seem to find the answer anywhere. How would I do a recursive mapping? For example, here is my current factory method that maps a…
Adam Rackis
  • 82,527
  • 56
  • 270
  • 393
1
vote
1 answer

using a factory to create new objects in ValueInjecter

When using the format... var customerInput = Mapper.Map(customer); A CustomerInput is created using Activator.CreateInstance. I would think there should be a way to use a factory to create these objects. So we would like to... var…
John Livermore
  • 30,235
  • 44
  • 126
  • 216
1
vote
1 answer

valueinjecter not copying nested properties values

I have following class: public class Ad { public int Id {get;set;} public string Title { get; set; } public string UrlTitle { get; set; } public LookUp Color {get;set} public LookUp Condition {get;set} public int…
Usman Khalid
  • 3,032
  • 9
  • 41
  • 66
1
vote
1 answer

The type or name "KnownSourceValueInjection" could not be found

I Would like to know why is this method found as an answer on many questions here not working, there are errors in "KnownSourceValueInjection". Also "GetByName(...)"is not working, it says: "propertyinfo[]" does not contain a definition for…
Victor Garcia
  • 179
  • 1
  • 12
1
vote
0 answers

Is there a way to map nested collections using ValueInjecter?

I have an EF data structure which has data nested two levels deep, it looks roughly like this: class Country { string Name {get; set;} ICollection States {get; set;} } class State { string Name {get; set;} ICollection
THBBFT
  • 1,161
  • 1
  • 13
  • 29
1
vote
1 answer

Where do I add initialisation code in a class library?

I've got a class library that users the ValueInjecter library. In some cases, I need to create custom maps and I'm not sure where I need to put the call(s) to Mapper.AddMap(). If I was using this in an application with a main entry point I could do…
Jake
  • 1,701
  • 3
  • 23
  • 44
1
vote
2 answers

Deep cloning objects with children

I’m looking for a solution were I can copy an object with several levels of children, update the primary key (and foreign key of the children) and save it on the DB again. Just so I can have an exact copy of the whole object but with a new key. I…
user441365
  • 3,934
  • 11
  • 43
  • 62
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