Injecting to a dynamic

Feb 23, 2011 at 1:12 PM

I've managed to inject values to a static target type from a dynamic source type.

However, I can't manage to inject to a dynamic target type from a static source type.

There is probably a built-in injecter/option for this, I just can't find it.


Feb 23, 2011 at 2:46 PM

I think this isn't possible because you can't get a list of properties of the dynamic type

Feb 28, 2011 at 12:47 PM

I managed to solve it using something like the following code:

private class VersionInjection : ValueInjection
	protected override void Inject(object source, dynamic target)
		var expando = target as IDictionary<string, object>;
		if (expando == null)

		foreach (var s in source.GetProps())
			expando[s.Name] = s.GetValue(source);


Feb 28, 2011 at 12:50 PM

gj, keep it up