示例#1
0
        private void SetProperties(object target, IEnumerable source)
        {
            if (target == null || source == null)
            {
                return;
            }

            if (target.GetType().IsDictionary())
            {
                var entries = DictionaryExtension.ToDictionary(source);
            }
        }
示例#2
0
        public T Populate <T>(Func <T> creator = null)
        {
            var dictionary = DictionaryExtension.ToDictionary <string, object>((System.Collections.IDictionary)_properties);

            return(DictionarySerializer.Default.Deserialize <T>((System.Collections.IDictionary)dictionary, creator, ctx =>
            {
                if (ctx.Direction == Converter.ObjectResolvingDirection.Get)
                {
                    ctx.Handled = false;
                    return;
                }

                var text = ctx.Value as string;

                if (text != null)
                {
                    ctx.Value = PluginUtility.ResolveValue(_builtin, text, ctx.MemberName, ctx.MemberType, Converter.GetDefaultValue(ctx.MemberType));
                }
            }));
        }