private ProxyProvidedMethodInfo(RdProvidedMethodInfo methodInfo, int typeProviderId,
                                        TypeProvidersContext typeProvidersContext, ProvidedTypeContextHolder context) : base(null, context.Context)
        {
            myMethodInfo           = methodInfo;
            myTypeProviderId       = typeProviderId;
            myTypeProvidersContext = typeProvidersContext;
            myContext = context;

            myParameters = new InterruptibleLazy <ProvidedParameterInfo[]>(
                // ReSharper disable once CoVariantArrayConversion
                () => myTypeProvidersContext.Connection
                .ExecuteWithCatch(() => RdProvidedMethodInfoProcessModel.GetParameters.Sync(EntityId))
                .Select(t => ProxyProvidedParameterInfo.Create(t, myTypeProviderId, typeProvidersContext, context))
                .ToArray());

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

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

            myTypes = new InterruptibleLazy <ProvidedType[]>(() =>
                                                             myTypeProvidersContext.ProvidedTypesCache.GetOrCreateBatch(
                                                                 new[] { methodInfo.DeclaringType, methodInfo.ReturnType },
                                                                 myTypeProviderId, context));

            myCustomAttributes = new InterruptibleLazy <RdCustomAttributeData[]>(() =>
                                                                                 myTypeProvidersContext.ProvidedCustomAttributeProvider.GetCustomAttributes(this));
        }
Ejemplo n.º 2
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.º 3
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>();
        }