public TransactionContext(IServiceProvider serviceProvider, ITransactionContextConfiguration <T> config = null) : base(serviceProvider, config) { _target = new Lazy <TransactionContextEntity <T> >(GetTargetContextEntity); _current = new Lazy <TransactionContextEntity <T> >(GetCurrentContextEntity); _initialEntity = new Lazy <EntityAccessor <T> >(GetInitialEntity); }
public override Entity Get <T>(ITransactionContext <T> context, ITransactionContextConfiguration <T> config) { var stage = context.PluginExecutionContext.Stage; return(stage != (int)SdkMessageProcessingStepStage.Postoperation ? new Entity(context.Target.LogicalName, context.Target.Id) : CommonHandler.Get(context, config)); }
private static Entity GetEntityFromDatabase <T>(ITransactionContext <T> context, ITransactionContextConfiguration <T> config) where T : Entity { var logicalName = context.Target.LogicalName; var id = context.Target.Id; return(context.Service.Retrieve(logicalName, id, config.ColumnSet)); }
public override Entity Get <T>(ITransactionContext <T> context, ITransactionContextConfiguration <T> config) => GetEntityFromImage(context) ?? GetEntityFromDatabase(context, config);
public abstract Entity Get <T>(ITransactionContext <T> context, ITransactionContextConfiguration <T> config) where T : Entity;
protected TransactionContextBase(IServiceProvider serviceProvider, ITransactionContextConfiguration <T> config) : base(serviceProvider) { Config = config ?? new PluginConfiguration <T>(); }
public static ITransactionContext <Entity> ToTransactionContext(this IServiceProvider serviceProvider, ITransactionContextConfiguration <Entity> config = null) => serviceProvider.ToTransactionContext <Entity>(config);
public static ITransactionContext <T> ToTransactionContext <T>(this IServiceProvider serviceProvider, ITransactionContextConfiguration <T> config = null) where T : Entity => new TransactionContext <T>(serviceProvider, config);