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