Beispiel #1
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>();
        }
Beispiel #2
0
 public static ProxyProvidedType Create(
     RdOutOfProcessProvidedType type,
     int typeProviderId,
     TypeProvidersContext typeProvidersContext,
     ProvidedTypeContextHolder context) =>
 type == null ? null : new ProxyProvidedType(type, typeProviderId, typeProvidersContext, context);