Пример #1
0
        /// <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;
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        /// <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);
        }
Пример #4
0
 public CommentService(IBloggingUnitOfWork unitOfWork,
                       IUriService uriService,
                       ITimeService timeService,
                       IMapper mapper)
 {
     _unitOfWork  = unitOfWork;
     _uriService  = uriService;
     _timeService = timeService;
     _mapper      = mapper;
 }
Пример #5
0
 public IdentityService(IBloggingUnitOfWork unitOfWork,
                        IMapper mapper,
                        IConfiguration configuration,
                        IStringLocalizer <IdentityService> locale)
 {
     _unitOfWork    = unitOfWork;
     _mapper        = mapper;
     _configuration = configuration;
     _locale        = locale;
 }
Пример #6
0
 /// <summary>
 /// Performs cleanup of the underlying unit-of-work object.
 /// </summary>
 private void CleanupUnitOfWork()
 {
     UnitOfWork?.Dispose();
     UnitOfWork = null;
 }
Пример #7
0
 public VerificationStatusController(IBloggingUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
Пример #8
0
 public TagController(IBloggingUnitOfWork unitOfWork, IMapper mapper)
 {
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
 }
Пример #9
0
 public RatingService(IBloggingUnitOfWork unitOfWork, IMapper mapper)
 {
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
 }
Пример #10
0
 public BloggingService(IBloggingUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }