Ejemplo n.º 1
0
        private ProxyProvidedPropertyInfo(RdProvidedPropertyInfo propertyInfo, int typeProviderId,
                                          TypeProvidersContext typeProvidersContext, ProvidedTypeContextHolder context) : base(null, context.Context)
        {
            myPropertyInfo         = propertyInfo;
            myTypeProviderId       = typeProviderId;
            myTypeProvidersContext = typeProvidersContext;
            myContext = context;

            myMethods = new InterruptibleLazy <ProvidedMethodInfo[]>(() =>
                                                                     // ReSharper disable once CoVariantArrayConversion
                                                                     GetMethodsInfos()
                                                                     .Select(t => ProxyProvidedMethodInfo.Create(t, typeProviderId, typeProvidersContext, context))
                                                                     .ToArray());

            myIndexParameters = new InterruptibleLazy <ProvidedParameterInfo[]>(
                () => // ReSharper disable once CoVariantArrayConversion
                propertyInfo.IndexParameters
                .Select(t => ProxyProvidedParameterInfo.Create(t, typeProviderId, typeProvidersContext, context))
                .ToArray());

            myCustomAttributes = new InterruptibleLazy <RdCustomAttributeData[]>(() =>
                                                                                 myTypeProvidersContext.ProvidedCustomAttributeProvider.GetCustomAttributes(this));
        }
Ejemplo n.º 2
0
        private ProxyProvidedType(RdOutOfProcessProvidedType rdProvidedType, int typeProviderId,
                                  TypeProvidersContext typeProvidersContext,
                                  ProvidedTypeContextHolder context) : base(null, context.Context)
        {
            myRdProvidedType       = rdProvidedType;
            myTypeProviderId       = typeProviderId;
            myTypeProvidersContext = typeProvidersContext;
            myContext = context;

            myInterfaces = new InterruptibleLazy <ProvidedType[]>(() =>
                                                                  myTypeProvidersContext.ProvidedTypesCache.GetOrCreateBatch(
                                                                      myTypeProvidersContext.Connection.ExecuteWithCatch(() =>
                                                                                                                         RdProvidedTypeProcessModel.GetInterfaces.Sync(EntityId)),
                                                                      typeProviderId, context));

            myGenericArguments = new InterruptibleLazy <ProvidedType[]>(() =>
                                                                        myTypeProvidersContext.ProvidedTypesCache.GetOrCreateBatch(myRdProvidedType.GenericArguments, typeProviderId,
                                                                                                                                   context));

            myMethods = new InterruptibleLazy <ProvidedMethodInfo[]>(() =>
                                                                     // ReSharper disable once CoVariantArrayConversion
                                                                     myTypeProvidersContext.Connection
                                                                     .ExecuteWithCatch(() => RdProvidedTypeProcessModel.GetMethods.Sync(EntityId, RpcTimeouts.Maximal))
                                                                     .Select(t => ProxyProvidedMethodInfo.Create(t, typeProviderId, typeProvidersContext, context))
                                                                     .ToArray());

            myAllNestedTypes = new InterruptibleLazy <ProvidedType[]>(() =>
                                                                      myTypeProvidersContext.ProvidedTypesCache.GetOrCreateBatch(myTypeProvidersContext.Connection.ExecuteWithCatch(
                                                                                                                                     () =>
                                                                                                                                     RdProvidedTypeProcessModel.GetAllNestedTypes.Sync(EntityId, RpcTimeouts.Maximal)), typeProviderId,
                                                                                                                                 context));

            myProperties = new InterruptibleLazy <ProvidedPropertyInfo[]>(() =>
                                                                          // ReSharper disable once CoVariantArrayConversion
                                                                          myTypeProvidersContext.Connection
                                                                          .ExecuteWithCatch(() => RdProvidedTypeProcessModel.GetProperties.Sync(EntityId, RpcTimeouts.Maximal))
                                                                          .Select(t => ProxyProvidedPropertyInfo.Create(t, myTypeProviderId, myTypeProvidersContext, context))
                                                                          .ToArray());

            myStaticParameters = new InterruptibleLazy <ProvidedParameterInfo[]>(() =>
                                                                                 // ReSharper disable once CoVariantArrayConversion
                                                                                 myTypeProvidersContext.Connection
                                                                                 .ExecuteWithCatch(() => RdProvidedTypeProcessModel.GetStaticParameters.Sync(EntityId, RpcTimeouts.Maximal))
                                                                                 .Select(t => ProxyProvidedParameterInfo.Create(t, myTypeProviderId, myTypeProvidersContext, context))
                                                                                 .ToArray());

            myFields = new InterruptibleLazy <ProvidedFieldInfo[]>(() =>
                                                                   // ReSharper disable once CoVariantArrayConversion
                                                                   myTypeProvidersContext.Connection
                                                                   .ExecuteWithCatch(() => RdProvidedTypeProcessModel.GetFields.Sync(EntityId, RpcTimeouts.Maximal))
                                                                   .Select(t => ProxyProvidedFieldInfo.Create(t, myTypeProviderId, typeProvidersContext, context))
                                                                   .ToArray());

            myEvents = new InterruptibleLazy <ProvidedEventInfo[]>(() =>
                                                                   // ReSharper disable once CoVariantArrayConversion
                                                                   myTypeProvidersContext.Connection
                                                                   .ExecuteWithCatch(() => RdProvidedTypeProcessModel.GetEvents.Sync(EntityId, RpcTimeouts.Maximal))
                                                                   .Select(t => ProxyProvidedEventInfo.Create(t, myTypeProviderId, myTypeProvidersContext, context))
                                                                   .ToArray());

            myConstructors = new InterruptibleLazy <ProvidedConstructorInfo[]>(() =>
                                                                               // ReSharper disable once CoVariantArrayConversion
                                                                               myTypeProvidersContext.Connection
                                                                               .ExecuteWithCatch(() => RdProvidedTypeProcessModel.GetConstructors.Sync(EntityId, RpcTimeouts.Maximal))
                                                                               .Select(t => ProxyProvidedConstructorInfo.Create(t, myTypeProviderId, myTypeProvidersContext, context))
                                                                               .ToArray());

            myCustomAttributes = new InterruptibleLazy <RdCustomAttributeData[]>(() =>
                                                                                 myTypeProvidersContext.ProvidedCustomAttributeProvider.GetCustomAttributes(this));

            myMakeArrayTypesCache = new Dictionary <int, ProvidedType>();
            myGenericTypesCache   = new Dictionary <string, ProvidedType>();
        }
        private ProxyProvidedEventInfo(RdProvidedEventInfo eventInfo, int typeProviderId,
                                       TypeProvidersContext typeProvidersContext,
                                       ProvidedTypeContextHolder context) : base(null, context.Context)
        {
            myEventInfo            = eventInfo;
            myTypeProvidersContext = typeProvidersContext;

            myMethods = new InterruptibleLazy <ProvidedMethodInfo[]>(() =>
                                                                     // ReSharper disable once CoVariantArrayConversion
                                                                     myTypeProvidersContext.Connection.ExecuteWithCatch(() =>
                                                                                                                        typeProvidersContext.Connection.ProtocolModel.RdProvidedMethodInfoProcessModel.GetProvidedMethodInfos
                                                                                                                        .Sync(new[] { eventInfo.AddMethod, eventInfo.RemoveMethod }, RpcTimeouts.Maximal)
                                                                                                                        .Select(t => ProxyProvidedMethodInfo.Create(t, typeProviderId, typeProvidersContext, context))
                                                                                                                        .ToArray()));

            myTypes = new InterruptibleLazy <ProvidedType[]>(() =>
                                                             myTypeProvidersContext.ProvidedTypesCache.GetOrCreateBatch(
                                                                 new[] { eventInfo.DeclaringType, eventInfo.EventHandlerType }, typeProviderId, context));
        }