static PersistenceParticipantExtensions() { ParameterExpression instance = Expression.Parameter(typeof(System.Activities.Persistence.PersistenceParticipant), "this"); ParameterExpression readWriteValues = Expression.Parameter(typeof(IDictionary <XName, object>), nameof(readWriteValues)); ParameterExpression outReadWriteValues = Expression.Parameter(typeof(IDictionary <XName, object>).MakeByRefType(), nameof(readWriteValues)); ParameterExpression writeOnlyValues = Expression.Parameter(typeof(IDictionary <XName, object>), nameof(writeOnlyValues)); ParameterExpression outWriteOnlyValues = Expression.Parameter(typeof(IDictionary <XName, object>).MakeByRefType(), nameof(writeOnlyValues)); MethodInfo method; method = typeof(System.Activities.Persistence.PersistenceParticipant).GetProperty( IPersistencePipelineModuleFullName + nameof(IsIOParticipant), BindingFlags.Instance | BindingFlags.NonPublic).GetMethod; isIOParticipant = Expression.Lambda <IsIOParticipantDelegate>( Expression.Call(instance, method), true, instance).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(CollectValues), BindingFlags.Instance | BindingFlags.NonPublic); collectValues = Expression.Lambda <CollectValuesDelegate>( Expression.Call(instance, method, outReadWriteValues, outWriteOnlyValues), true, instance, outReadWriteValues, outWriteOnlyValues).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(MapValues), BindingFlags.Instance | BindingFlags.NonPublic); mapValues = Expression.Lambda <MapValuesDelegate>( Expression.Call(instance, method, readWriteValues, writeOnlyValues), true, instance, readWriteValues, writeOnlyValues).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(PublishValues), BindingFlags.Instance | BindingFlags.NonPublic); publishValues = Expression.Lambda <PublishValuesDelegate>( Expression.Call(instance, method, readWriteValues), true, instance, readWriteValues).Compile(); }
static PersistenceParticipantExtensions() { ParameterExpression instance = Expression.Parameter(typeof(System.Activities.Persistence.PersistenceParticipant), "this"); ParameterExpression readWriteValues = Expression.Parameter(typeof(IDictionary<XName, object>), nameof(readWriteValues)); ParameterExpression outReadWriteValues = Expression.Parameter(typeof(IDictionary<XName, object>).MakeByRefType(), nameof(readWriteValues)); ParameterExpression writeOnlyValues = Expression.Parameter(typeof(IDictionary<XName, object>), nameof(writeOnlyValues)); ParameterExpression outWriteOnlyValues = Expression.Parameter(typeof(IDictionary<XName, object>).MakeByRefType(), nameof(writeOnlyValues)); MethodInfo method; method = typeof(System.Activities.Persistence.PersistenceParticipant).GetProperty( IPersistencePipelineModuleFullName + nameof(IsIOParticipant), BindingFlags.Instance | BindingFlags.NonPublic).GetMethod; isIOParticipant = Expression.Lambda<IsIOParticipantDelegate>( Expression.Call(instance, method), true, instance).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(CollectValues), BindingFlags.Instance | BindingFlags.NonPublic); collectValues = Expression.Lambda<CollectValuesDelegate>( Expression.Call(instance, method, outReadWriteValues, outWriteOnlyValues), true, instance, outReadWriteValues, outWriteOnlyValues).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(MapValues), BindingFlags.Instance | BindingFlags.NonPublic); mapValues = Expression.Lambda<MapValuesDelegate>( Expression.Call(instance, method, readWriteValues, writeOnlyValues), true, instance, readWriteValues, writeOnlyValues).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(PublishValues), BindingFlags.Instance | BindingFlags.NonPublic); publishValues = Expression.Lambda<PublishValuesDelegate>( Expression.Call(instance, method, readWriteValues), true, instance, readWriteValues).Compile(); }
static PersistenceParticipantExtensions() { #pragma warning disable IDE0007 // Use implicit type (https://github.com/dotnet/roslyn/issues/766) ParameterExpression instance = Expression.Parameter(typeof(System.Activities.Persistence.PersistenceParticipant), "this"); ParameterExpression readWriteValues = Expression.Parameter(typeof(IDictionary <XName, object>), nameof(readWriteValues)); ParameterExpression outReadWriteValues = Expression.Parameter(typeof(IDictionary <XName, object>).MakeByRefType(), nameof(readWriteValues)); ParameterExpression writeOnlyValues = Expression.Parameter(typeof(IDictionary <XName, object>), nameof(writeOnlyValues)); ParameterExpression outWriteOnlyValues = Expression.Parameter(typeof(IDictionary <XName, object>).MakeByRefType(), nameof(writeOnlyValues)); MethodInfo method; #pragma warning restore IDE0007 // Use implicit type method = typeof(System.Activities.Persistence.PersistenceParticipant).GetProperty( IPersistencePipelineModuleFullName + nameof(IsIOParticipant), BindingFlags.Instance | BindingFlags.NonPublic).GetMethod; isIOParticipant = Expression.Lambda <IsIOParticipantDelegate>( Expression.Call(instance, method), true, instance).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(CollectValues), BindingFlags.Instance | BindingFlags.NonPublic); collectValues = Expression.Lambda <CollectValuesDelegate>( Expression.Call(instance, method, outReadWriteValues, outWriteOnlyValues), true, instance, outReadWriteValues, outWriteOnlyValues).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(MapValues), BindingFlags.Instance | BindingFlags.NonPublic); mapValues = Expression.Lambda <MapValuesDelegate>( Expression.Call(instance, method, readWriteValues, writeOnlyValues), true, instance, readWriteValues, writeOnlyValues).Compile(); method = typeof(System.Activities.Persistence.PersistenceParticipant).GetMethod( IPersistencePipelineModuleFullName + nameof(PublishValues), BindingFlags.Instance | BindingFlags.NonPublic); publishValues = Expression.Lambda <PublishValuesDelegate>( Expression.Call(instance, method, readWriteValues), true, instance, readWriteValues).Compile(); }