/// <summary> /// Initializes the underlying connection to the data source. Callers can /// optionally pass a data source connection string or other key in the /// <paramref name="connectionString" /> parameter. /// </summary> /// <param name="connectionString"> /// String containing information to be utilized in /// making a connection to the specific data source needed. /// </param> /// <remarks> /// If the <paramref name="connectionString" /> parameter is an empty string /// or whitespace, then the default connection to the data source, as configured /// in App.config, is utilized. Otherwise, the connection string passed is /// sent to the underlying unit-of-work object. /// </remarks> // ReSharper disable once MemberCanBeProtected.Global public virtual void DoInitialize( IBloggingUnitOfWork unitOfWorkObject) { CleanupUnitOfWork(); UnitOfWork = unitOfWorkObject; }
/// <summary> /// Initializes all data services using the connection to the underlying data source provided by the unit-of-work object referenced by <paramref name="unitOfWorkObject" />. /// </summary> /// <param name="unitOfWorkObject"> /// Reference to an instance of an object that implements /// <see /// cref="T:MyBlogLister.BusinessLayer.BusinessLayer.IBloggingUnitOfWork" /> /// having the proper connection to the underlying data source. /// </param> /// <param name="exceptionRaisedEventHandler"> /// (Optional.) If specified, reference to a method that serves as a handler for /// exceptions raised by any one of the services. /// </param> public void InitializeAll(IBloggingUnitOfWork unitOfWorkObject, Action <Exception> exceptionRaisedEventHandler = null) { PostService.Instance.DoInitialize(unitOfWorkObject); BlogService.Instance.DoInitialize(unitOfWorkObject); InstallExceptionRaisedEventHandler(exceptionRaisedEventHandler); }
/// <summary> /// Initializes the underlying connection to the data source. Callers can /// optionally pass a data source connection string or other key in the /// <paramref name="connectionString" /> parameter. /// </summary> /// <param name="connectionString"> /// String containing information to be utilized in /// making a connection to the specific data source needed. /// </param> /// <remarks> /// If the <paramref name="connectionString" /> parameter is an empty string /// or whitespace, then the default connection to the data source, as configured /// in App.config, is utilized. Otherwise, the connection string passed is /// sent to the underlying unit-of-work object. /// </remarks> // ReSharper disable once MemberCanBeProtected.Global public virtual void DoInitialize( string connectionString = "") { CleanupUnitOfWork(); UnitOfWork = string.IsNullOrWhiteSpace(connectionString) ? new BloggingUnitOfWork() : new BloggingUnitOfWork(connectionString); }
public CommentService(IBloggingUnitOfWork unitOfWork, IUriService uriService, ITimeService timeService, IMapper mapper) { _unitOfWork = unitOfWork; _uriService = uriService; _timeService = timeService; _mapper = mapper; }
public IdentityService(IBloggingUnitOfWork unitOfWork, IMapper mapper, IConfiguration configuration, IStringLocalizer <IdentityService> locale) { _unitOfWork = unitOfWork; _mapper = mapper; _configuration = configuration; _locale = locale; }
/// <summary> /// Performs cleanup of the underlying unit-of-work object. /// </summary> private void CleanupUnitOfWork() { UnitOfWork?.Dispose(); UnitOfWork = null; }
public VerificationStatusController(IBloggingUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }
public TagController(IBloggingUnitOfWork unitOfWork, IMapper mapper) { _unitOfWork = unitOfWork; _mapper = mapper; }
public RatingService(IBloggingUnitOfWork unitOfWork, IMapper mapper) { _unitOfWork = unitOfWork; _mapper = mapper; }
public BloggingService(IBloggingUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }