예제 #1
0
 private static void InstantiateFromCache(object instance)
 {
     foreach (var invocationInfo in BindingCache.GetInvocationInfo(instance))
     {
         SetValue(instance, invocationInfo.Value);
     }
 }
예제 #2
0
 private static void InstantiateByScanningType(object instance)
 {
     BindingCache.AddTypeToCache(instance);
     foreach (var member in GetMembers(instance))
     {
         InstantiateBoundElement(instance, member);
     }
 }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
 internal static object BindDependenciesCore(object instance)
 {
     if (!BindingCache.IsCached(instance))
     {
         InstantiateByScanningType(instance);
     }
     else
     {
         InstantiateFromCache(instance);
     }
     return(instance);
 }