Ncqrs.Eventing.Storage.PropertyBagConverter.InitializeInstancePropertiesFrom C# (CSharp) Méthode

InitializeInstancePropertiesFrom() private static méthode

private static InitializeInstancePropertiesFrom ( PropertyBag bag, object target ) : bool
bag PropertyBag
target object
Résultat bool
        private static bool InitializeInstancePropertiesFrom(PropertyBag bag, object target)
        {
            bool completelyInitialized = true;

            foreach (KeyValuePair<string, object> pair in bag.Properties)
            {
                string propertyName = pair.Key;
                object propertyValue = pair.Value;

                PropertyInfo targetProperty = target.GetType().GetProperty(propertyName);
                if (IsPropertyWritable(targetProperty))
                {
                    completelyInitialized &= SetPropertyValue(target, targetProperty, propertyValue);
                }
            }

            return completelyInitialized;
        }