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
4
votes
3 answers

Using ValueInjecter to flatten objects including nullable types

I'm trying to use ValueInjector to flatten a class and to have it also copy across values from Nullable's to int's. Eg given the following (contrived) classes: class CustomerObject { public int CustomerID { get; set; } public string…
Rocklan
  • 7,888
  • 3
  • 34
  • 49
3
votes
1 answer

Entity Framework Detached Object Merging

I have a scenario where I am using Entity Framework in a WCF service, and changes happen on a non-tracked instance of a type that is mapped back to the database via code-first (non-trivial updates and deletes throughout the instance's object tree). …
3
votes
3 answers

AutoMapper Data Filling

Would it be possible to use AutoMapper in order to fill in an object with details from another object? For example (assuming previous configuration): var foo = new Foo { PropA = "", PropB = "Foo" }; var bar = new Bar { PropA = "Bar", PropB = ""…
jdscolam
  • 988
  • 8
  • 20
3
votes
3 answers

dynamic type casting in custom ValueInjecter injection

I have created a custom injection class for ValueInjecter that does recursive injection for generic child collections, but that works with the existing target objects rather than cloning like the "CloneInjection" sample on the VI site. However,…
DanO
  • 911
  • 1
  • 8
  • 16
3
votes
1 answer

How to map ValueInjecter using Json Object?

If I have Json object that I want to map to a concrete object, how would I do that? public class Student { public string Name { get; set; } } class Program { static void Main(string[] args) { …
chobo2
  • 83,322
  • 195
  • 530
  • 832
3
votes
3 answers

Omu.ValueInjecter checking property before allowing a set to occur

I need to extend the Omu.ValueInjecter to perform a check before a property assignment is made. Given the code example below, assignment of prop A should only occur if SetA is true. I suspect LoopValueInjection is not the right base class here,…
John Livermore
  • 30,235
  • 44
  • 126
  • 216
3
votes
2 answers

How to loop through a HashSet when it is provided as an object and the T can be anything?

I'm using Value Injecters to map from 1 type to another using the LoopValueInjection and overriding the SetValue(object v) method with some custom logic. I am trying to detect when a HashSet is being passed in and go through the HashSet and apply a…
Jeff Treuting
  • 13,910
  • 8
  • 36
  • 47
3
votes
1 answer

Using ValueInjecter, is there a way to only inject a given property one time

Given 3 classes, A, and B which each have an ID property, and then various other properties and C, which has an ID, and the combined properties of A and B, I want to C.InjectFrom(A); C.InjectFrom(B); such that the ID from A is preserved and not…
Jason Coyne
  • 6,509
  • 8
  • 40
  • 70
3
votes
4 answers

Copying NHibernate POCO to DTO without triggering lazy load or eager load

I need to create DTOs from NHibernate POCO objects. The problem is that the POCO objects contain dynamic proxies, which should not be copied to the DTO. I eager load all the collections and references I need to transfer in advance, I don't want…
Roman
  • 957
  • 8
  • 17
3
votes
1 answer

c# ValueInjecter : Mapping the whole object Graph

I just started using ValueInjecter for my Entity Mappings(DTO <-> Entity). Heres my DTO : public class IncidentDTO { int ID { get; set; } string Name { get; set; } AgencyDTO agencyDTO { get; set; } } public class AgencyDTO { int ID…
Prateek Singh
  • 863
  • 1
  • 8
  • 28
3
votes
2 answers

How to find the source property based on the name of a flattened property with ValueInjecter

This is a counterpart to same question (but with AutoMapper). I use ValueInjecter and am interested if there is a solution. Simplified code example: // get a list of viewModels for the grid. // NOTE: sort parameter is flattened property of the model…
zam6ak
  • 7,229
  • 11
  • 46
  • 84
3
votes
1 answer

Mapping umbraco node to strongtyped object

I am working with Umbraco 4.7.1 and I am trying to map the content-nodes to some autogenerated strong typed objects. I have tried using both valueinjecter and automapper, but OOTB neither of them map my properties. I guess it is because all…
ThomasD
  • 2,464
  • 6
  • 40
  • 56
2
votes
1 answer

ValueInjecter does it have these automapper features?

I am currently using auto mapper and I think it is a good tool but I don't like how it can't handle view model to domain situations. It kinda sucks that I have to go in the automapping and map each one. I been looking around and been reading about…
chobo2
  • 83,322
  • 195
  • 530
  • 832
2
votes
1 answer

ValueInjector not mapping IDs from view model

I'm using ValueInjecter to inject data from my view model to my entity framework model, and for non Ids such as strings it works great. For some reason it is not mapping the IDs from select lists in my view, once mapped they show up as null. Any…
NullReference
  • 4,404
  • 12
  • 53
  • 90
2
votes
1 answer

Map a dynamic object with ValueInjecter

I'm retrieving data with Simple.Data - which maps the database table to a dynamic object. I want to map the dynamic object to a simple type. I have tried this: var dbObject =…
Neil Thompson
  • 6,356
  • 2
  • 30
  • 53
1 2
3
10 11