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
2
votes
1 answer

Flattening with ValueInjecter

I try to map multiple objects to a view model object with ValueInjecter. But it does not work as I expect it. Code: class Call { public string Number { get; set; } public string CustomerNumber { get; set; } } class Operation { public…
Sandro
  • 2,998
  • 2
  • 25
  • 51
2
votes
2 answers

How to prevent values in "Target" object being overwritten by nulls from "Source" object when using ValueInjector or Automapper? Nested Mapping Issue?

My Problem "Source" object Properties of the same class that do not exist in the View, are overwritting the same properties in the "Target" object with nulls. How do I prevent this? In affect how do I ensure only populated(not null) properties are…
EdB
  • 449
  • 6
  • 21
2
votes
1 answer

How do I create a custom value injection to map my entity to my view model? Attempt included

I'm trying to use the ValueInjector (latest version from NuGet) to inject my view model with data from my EntityFramework Code First object. I'll want to do the reverse of this as well, but this is the attempt I'm starting with. I've researched the…
jason
  • 2,219
  • 5
  • 33
  • 66
2
votes
0 answers

Flattening collections with ValueInjector or AutoMapper

Given the following sample classes: public class OrderHeader { public int OrderHeaderId { get; set; } public string CustomerName { get; set; } } public class OrderItem { public int OrderHeaderId { get; set; } public int OrderItemId…
Metro Smurf
  • 37,266
  • 20
  • 108
  • 140
2
votes
4 answers

Inline constructor and InjectFrom calls return Object

Using ValueInjecter, I often find myself writing code like this: var foo1 = new Foo().InjectFrom(foo2); But that, unexpectedly, causes foo1 to be of type Object, not Foo. Same with var foo1 = (new Foo()).InjectFrom(foo2); and Foo foo1 = new…
wohanley
  • 434
  • 5
  • 14
2
votes
1 answer

ValueInjector not mapping property

I'm having trouble trying to get ValueInjector to map my objects correctly. This is the code I am using for the mapping: public IEnumerable FindCategories(IList criteria) { IEnumerable categories =…
Tyler Wright
  • 795
  • 1
  • 9
  • 28
2
votes
1 answer

ValueInjecter different types/property names

is it possible to inject from something like this : public class DomainEntity { public Resource DescriptionResource { get; set; } } public class Resource { public List Localizations { get; set; } } public class…
shkipper
  • 1,403
  • 3
  • 21
  • 35
2
votes
1 answer

Changing null strings to string.Empty using ValueInjecter

I'm using ValueInjecter to flatten/unflatten view models into domain objects created by Entity Framework (4.3.1) model-first. All of my VARCHAR columns in my database are NOT NULL DEFAULT '' (personal preference, no desire to open up a holy war…
AJ.
  • 16,368
  • 20
  • 95
  • 150
2
votes
1 answer

what does FlatLoop/UnFlatLoop mean in valueinjecter?

here is the valueinjecter doc(http://valueinjecter.codeplex.com/documentation), but i'm not so clear about these terms, flattening/unflattening ,FlatLoop/UnFlatLoop ... , how could i understand these easier ? thanks !
dfang
  • 1,366
  • 15
  • 41
2
votes
2 answers

Framework for merging business entities

Is there any framework which can do the following: var source = new Entity() { StringProp = null, IntProp = 100, }; var target = new Entity() { StringProp = "stringValue", // Property value should remain the same if source value is…
k0stya
  • 4,267
  • 32
  • 41
1
vote
1 answer

How can I inspect the attributes of a target property using Value Injector?

I'm using Value Injector to manage my mappings in an ASP.NET MVC project and it's been great so far. The domain has the concept of a length measurement stored as standard metric units in the db and exposed as a decimal value up to the service…
D-Man
  • 62
  • 4
1
vote
1 answer

valueInjecter is taking too much time

I'm new to ValueInjecter, I've used it for a week from a sample app. Now this is the code I'm trying using public virtual TInput MapToInput(TEntity entity) { var input = new TInput(); input.InjectFrom(entity) …
afr0
  • 848
  • 1
  • 11
  • 29
1
vote
1 answer

How to keep the value of the source when using InjectFrom

By injecting values ​​into my domain object, I would keep the values ​​of some properties. Example: Domain model public class Person { public string Name { get; set; } public Guid ID { get; set; } public DateTime CreateAt { get; set; } …
ridermansb
  • 10,779
  • 24
  • 115
  • 226
1
vote
1 answer

ValueInjecter architecture advise

im kinda new to value injecter, to the whole object to object mapping world actualy. seems like valueinjecter is one of the better choice out as of the moment. Im wondering what is the best way of mapping this kind of objects Basically what i want…
reggieboyYEAH
  • 870
  • 3
  • 11
  • 28
1
vote
2 answers

ValueInjecter Mapping ViewModel To Domain

I am playing around with valueinjecter and wondering how do I do viewmodels to domains when the view model has a collection of viewmodels? Say I have this domain public class MyDomain { public IList MyOtherDomains {get;…
chobo2
  • 83,322
  • 195
  • 530
  • 832