Пример #1
0
 /// <summary>
 /// Allows to execute a given <paramref name="func" /> within an ensured <paramref name="ctx" /> including
 /// disposing the <paramref name="ctx" /> if none was given.
 /// </summary>
 /// <typeparam name="TResult">The result type of the <paramref name="func" />.</typeparam>
 /// <param name="func">The function to execute including an EF context.</param>
 /// <param name="ctx">The context or <c>null</c> if a new should be created.</param>
 /// <returns>The result of the <paramref name="func" />.</returns>
 protected TResult ExecuteContextWrapped <TResult>(Func <TContext, TResult> func, TContext ctx = null)
 {
     return(EntityContextUtil.ExecuteContextWrapped(func, ctx, ContextResolver, Logger));
 }
Пример #2
0
 /// <summary>
 /// Allows to execute a given <paramref name="action" /> within an ensured <paramref name="ctx" /> including
 /// disposing the <paramref name="ctx" /> if none was given.
 /// </summary>
 /// <param name="action">The action to execute including an EF context.</param>
 /// <param name="ctx">The context or <c>null</c> if a new should be created.</param>
 protected void ExecuteContextWrapped(Action <TContext> action, TContext ctx = null)
 {
     EntityContextUtil.ExecuteContextWrapped(action, ctx, ContextResolver, Logger);
 }