private static void InstantiateFromCache(object instance) { foreach (var invocationInfo in BindingCache.GetInvocationInfo(instance)) { SetValue(instance, invocationInfo.Value); } }
private static void InstantiateByScanningType(object instance) { BindingCache.AddTypeToCache(instance); foreach (var member in GetMembers(instance)) { InstantiateBoundElement(instance, member); } }
private static void InvokeField(object instance, MemberInfo member, BoundAttribute boundAttribute) { if (member.MemberType != MemberTypes.Field) { return; } var fieldInfo = member as FieldInfo; SetValue(instance, BindingCache.CacheMemberBinding(instance, member, boundAttribute, fieldInfo.FieldType, FieldBindingFlags)); }
private static void InvokeProperty(object instance, MemberInfo member, BoundAttribute boundAttribute) { if (member.MemberType != MemberTypes.Property) { return; } var propertyInfo = member as PropertyInfo; var type = propertyInfo.PropertyType; SetValue(instance, BindingCache.CacheMemberBinding(instance, member, boundAttribute, type, PropertyBindingFlags)); }
internal static object BindDependenciesCore(object instance) { if (!BindingCache.IsCached(instance)) { InstantiateByScanningType(instance); } else { InstantiateFromCache(instance); } return(instance); }