public static IServiceCollection AddStorageModule(this IServiceCollection services, StorageOptions storageOptions, MessageBrokerOptions messageBrokerOptions, string connectionString, string migrationsAssembly = "") { services.AddDbContext <StorageDbContext>(options => options.UseSqlServer(connectionString, sql => { if (!string.IsNullOrEmpty(migrationsAssembly)) { sql.MigrationsAssembly(migrationsAssembly); } })) .AddScoped <IRepository <FileEntry, Guid>, Repository <FileEntry, Guid> >(); DomainEvents.RegisterHandlers(Assembly.GetExecutingAssembly(), services); services.AddMessageHandlers(Assembly.GetExecutingAssembly()); services.AddStorageManager(storageOptions); services.AddMessageBusSender <FileUploadedEvent>(messageBrokerOptions); services.AddMessageBusSender <FileDeletedEvent>(messageBrokerOptions); services.AddAuthorizationPolicies(Assembly.GetExecutingAssembly()); return(services); }
/// <summary> /// Insert/update the customer /// If it already exists, update it, otherwise insert it. /// If the email address has changed, raise a EmailAddressChanged event on DomainEvents /// </summary> public void Upsert(Customer customer) { if (customer == null) { throw new ArgumentNullException("customer"); } var db = new DbContext(); var existingDbCust = GetById(customer.Id); var newDbCust = ToDbCustomer(customer); if (existingDbCust == null) { // insert db.Insert(newDbCust); // Note that this code does not trap exceptions coming from the database. What would it do with them? // Compare with the F# version, where errors are alway returned from the call } else { // update db.Update(newDbCust); // check for changed email if (!customer.EmailAddress.Equals(existingDbCust.EmailAddress)) { // Generate a event // Note that this code is buried deep in a class and is not obvious // It is also hard to turn on and off (eg for batch updates) without adding extra complications // // Compare this with the F# version, when an event is returned from the call itself. DomainEvents.OnEmailAddressChanged(existingDbCust.EmailAddress, customer.EmailAddress); } } }
private void CompleteIfPossible() { if (Data.LeadSignedUpReceived && Data.InitializeClientReceived) { DomainEvents.Register <ClientInitializedDomainEvent>(ClientInitializedDomainEventHandler); var services = ServiceRepository.GetByIds(Data.AgreementServiceIds); Client.Initialize( Data.ClientId, Data.ClientName, Data.ClientAddress1, Data.ClientAddress2, Data.ClientAddress3, Data.ClientPhoneNumber, Data.ClientEmailAddress, Data.DealId, Data.AgreementCommencement, Data.AgreementExpiry, services); MarkAsComplete(); ClientRepository.Flush(); } }
/// <summary> /// 挂失 /// </summary> /// <param name="userId"></param> public void Loss(int userId) { if (this.Status == AccountStatus.Loss) { throw new DomainException("该竞买号已经挂失过一次,不能再次挂失"); } else { if (this.Trade.CreatorId != userId) { throw new AccountFrozeException("挂牌人只能挂失自己宗地的竞买号"); } var days = AppSettings.GetValue("MinLoseNum2TEDay", 2); if (DateTime.Now > this.Trade.TradeEndTime.AddDays(-days)) { throw new GrantApplyNumberException(string.Format("现在离挂牌交易截止期限不足{0}日,不能挂失", days)); } this.Status = AccountStatus.Loss; DomainEvents.Publish(new LossAccountEvent() { Account = this }); } }
private void CheckForCompletion() { if (NumberOfMessagesForwarded + NumberOfMessagesSkipped != TotalNumberOfMessages) { return; } RetryState = RetryState.Completed; CompletionTime = DateTime.UtcNow; DomainEvents.Raise(new RetryOperationCompleted { RequestId = requestId, RetryType = retryType, Failed = Failed, Progress = GetProgress(), StartTime = Started, CompletionTime = CompletionTime.Value, Originator = Originator, NumberOfMessagesProcessed = NumberOfMessagesForwarded, Last = Last ?? DateTime.MaxValue, Classifier = Classifier, }); if (retryType == RetryType.FailureGroup) { DomainEvents.Raise(new MessagesSubmittedForRetry { FailedMessageIds = new string[0], NumberOfFailedMessages = NumberOfMessagesForwarded, Context = Originator }); } Log.Info($"Retry operation {requestId} completed. {NumberOfMessagesSkipped} messages skipped, {NumberOfMessagesForwarded} forwarded. Total {TotalNumberOfMessages}."); }
public async Task CommitAsync() { try { using (var transaction = await _dbContext.Database.BeginTransactionAsync()) { try { await _dbContext.SaveChangesAsync(); if (!await _messageBus.IsAliveAsync()) { throw new ServiceMessageBusUnavailableException(); } transaction.Commit(); foreach (var e in DomainEvents.GetEvents()) { await _messageBus.PublishAsync(e); } DomainEvents.ClearEvents(); } catch (Exception) { transaction.Rollback(); throw; } } } catch (Exception) { throw; } }
public void TestSubscribe() { //Define a message class to send var msg = new Msg { Content = MagicString }; //subscribe you handlers DomainEvents <Msg> .Subscribe(Handler); //maby ways to send DomainEvents <Msg> .Publish(msg); DomainEvents.Publish(msg); DomainEvents.Publish(msg, typeof(Msg)); Assert.AreEqual(counter, 3); DomainEvents <Msg> .Unsubscribe(Handler); DomainEvents.Publish(msg); Assert.AreEqual(counter, 3); }
public async Task Context() { var specification = new TTransactionScopeUnitOfWorkMiddlewareSpecification(); var domainEventHandlerFactory = new FakeDomainEventHandlerFactory(domainEvent => _raisedDomainEvent = (TestDomainEvent)domainEvent); DomainEvents.Initialize(domainEventHandlerFactory); _volatileResourceManager = new VolatileResourceManager(); async Task _requestDelegate(HttpContext context) { _entityRepository = IoC.Resolve <IRepository <TestEntityWithDomainEvent> >(); _entity = new TestEntityWithDomainEvent(); _entity.BehaviouralMethodWithRaisingDomainEvent(); await _entityRepository.SaveAsync(_entity); _volatileResourceManager.SetMemberValue(23); } await specification.CreateMiddlewareAndInvokeHandling(_requestDelegate, _volatileResourceManager); }
public void Update(long genreId, long developerStudioId, long publisherId) { DeveloperStudioId = developerStudioId; PublisherId = publisherId; GenreId = genreId; GameUpdatedEvent gameUpdated = new GameUpdatedEvent { Id = Id, GenreId = genreId, Price = GameDetails.Price, Description = GameDetails.Description, AverageRating = GameDetails.AverageRating, Name = GameDetails.Name, ReleaseDate = GameDetails.ReleaseDate, AgeRestrictionSystem = GameDetails.AgeRestrictionSystem, IconUri = GameDetails.IconUri, PhotoUri = GameDetails.PhotoUri, ReviewCount = GameDetails.ReviewCount, OrderCount = GameDetails.OrderCount }; DomainEvents.Add(gameUpdated); }
public User Create(User user, string password) { if (string.IsNullOrWhiteSpace(password)) { throw new Exception("Password is required"); } if (this.userRepository.FindOne(x => x.UserName == user.UserName) != null) { throw new Exception("UserName \"" + user.UserName + "\" is already taken"); } byte[] passwordHash, passwordSalt; CreatePasswordHash(password, out passwordHash, out passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; this.userRepository.Create(user); this.userRepository.Save(); DomainEvents.Raise <UserRegistred>(new UserRegistred(_mapper.Map <UserDTO>(user))); return(user); }
private void InitializeCallIndicators() { DomainEvents.Register <CallStatusChanged>(args => { callStatus = args.CallStatus; skypeLightNotifyIcon.Icon = args.CallStatus == CallStatus.NotOnCall ? Resources.NoCallStatusIcon : Resources.OnCallStatusIcon; }); DomainEvents.Register <ToggleStatusRequested>(args => { if (callStatus == CallStatus.NotOnCall) { DomainEvents.Raise(new CallStatusChanged(CallStatus.OnAudioCall)); } else if (callStatus == CallStatus.OnAudioCall) { DomainEvents.Raise(new CallStatusChanged(CallStatus.NotOnCall)); } }); busylightService = new BusylightService(new BusylightAdapter()); busylightService.Initialize(); }
public Task <int> Load() { try { //load temp extracts without errors //var tempPatientExtracts = _tempPatientExtractRepository.GetAll().Where(a=>a.CheckError == false).ToList(); var tempPatientExtracts = _tempPatientExtractRepository.GetAll().Where(a => a.ErrorType == 0).ToList(); //Auto mapper var extractRecords = Mapper.Map <List <TempHTSClientExtract>, List <HTSClientExtract> >(tempPatientExtracts); //Batch Insert _patientExtractRepository.BatchInsert(extractRecords); Log.Debug("saved batch"); DomainEvents.Dispatch(new HtsNotification(new ExtractProgress(nameof(HTSClientExtract), "Loading...", Found, 0, 0, 0, 0))); return(Task.FromResult(tempPatientExtracts.Count)); } catch (Exception e) { Log.Error(e, $"Extract {nameof(HTSClientExtract)} not Loaded"); throw; } }
static void Main() { LogUtility.Initialise(); log = LogUtility.ForCurrentType(); var autoResetEvent = new AutoResetEvent(false); Console.CancelKeyPress += (sender, eventArgs) => { // cancel the cancellation to allow the program to shutdown cleanly eventArgs.Cancel = true; autoResetEvent.Set(); }; using (var container = new ContainerInitialiser().Create()) { RebusConfiguration.Init(container); Console.WriteLine("Application has started. Ctrl-C to end"); autoResetEvent.WaitOne(); log.InfoFormat("Shutting down service"); } using (var container = new ContainerInitialiser().Create()) { log.DebugFormat("Initialised container"); var starter = container.Resolve <IBusStarter>(); starter.Start(); DomainEvents.Configure(e => starter.Bus.Publish(e)); // main blocks here waiting for ctrl-C autoResetEvent.WaitOne(); log.InfoFormat("Shutting down"); } }
public static IServiceCollection AddApplicationServices(this IServiceCollection services, Action <Type, Type, ServiceLifetime> configureInterceptor = null) { DomainEvents.RegisterHandlers(Assembly.GetExecutingAssembly(), services); services .AddSingleton <IDomainEvents, DomainEvents>() .AddScoped(typeof(ICrudService <>), typeof(CrudService <>)) .AddScoped <IUserService, UserService>() .AddScoped <IProductService, ProductService>(); if (configureInterceptor != null) { var aggregateRootTypes = typeof(AggregateRoot <>).Assembly.GetTypes().Where(x => x.BaseType == typeof(AggregateRoot <Guid>)).ToList(); foreach (var type in aggregateRootTypes) { configureInterceptor(typeof(ICrudService <>).MakeGenericType(type), typeof(CrudService <>).MakeGenericType(type), ServiceLifetime.Scoped); } configureInterceptor(typeof(IUserService), typeof(UserService), ServiceLifetime.Scoped); configureInterceptor(typeof(IProductService), typeof(ProductService), ServiceLifetime.Scoped); } return(services); }
public async Task Context() { var specification = new TUnitOfWorkMiddlewareSpecification(); var domainEventHandlerFactory = new FakeDomainEventHandlerFactory(domainEvent => _raisedDomainEvent = (TestDomainEvent)domainEvent); DomainEvents.Initialize(domainEventHandlerFactory, isDelayedDomainEventHandlingEnabled: true); DomainEvents.ResetDelayedEventsStorage(); async Task _requestDelegate(HttpContext context) { _entityRepository = IoC.Resolve <IRepository <TestEntityWithDomainEvent> >(); _entity = new TestEntityWithDomainEvent(); await _entityRepository.SaveAsync(_entity); throw new NotSupportedException("test exception"); } try { await specification.CreateMiddlewareAndInvokeHandling(_requestDelegate); } catch (NotSupportedException) {} }
private void Application_EndRequest(Object source, EventArgs e) { if (HttpContext.Current.Server.GetLastError() != null) { return; } try { UnitOfWork.Commit(); DomainEvents.RaiseDelayedEvents(); } catch { UnitOfWork.Rollback(); throw; } finally { _unitOfWorkFactory.Release(UnitOfWork); UnitOfWork = null; } }
public void WhenThePosterAcceptsAnAsnwer_TheAnswer_ShouldBeMarkedAsAccepted() { var poster = new Poster(new Name("Joe", "Bloggs")); var content = new PlainTextContent(); var question = new Question("A question", content, poster); var contributor = new Contributor(new Name("Joe", "Bloggs"), new Reputation(1000)); var answer = new Answer(question.Id, contributor, new PlainTextContent("This is an answer")); question.AddAnAnswer(answer); var isAccepted = false; DomainEvents.ListenFor <AnswerAccepted>(@event => { isAccepted = true; }); question.AcceptAnswer(answer.Id, poster.Id); Assert.True(isAccepted); Assert.NotNull(question.AcceptedAnswer); Assert.Equal(answer, question.AcceptedAnswer); }
public void UpdateHoursRemaining(int hours) { if (hours < 0) { return; } int currentHoursRemaining = HoursRemaining; try { HoursRemaining = hours; DomainEvents.Raise(new TaskHoursUpdatedEvent(this)); if (HoursRemaining == 0) { MarkComplete(); return; } IsComplete = false; } catch (Exception) { HoursRemaining = currentHoursRemaining; } }
public void Update(UpdateHolidayRequest request) { var session = _sessionFactory.OpenSession(); CurrentSessionContext.Bind(session); try { using (var transactionScope = new TransactionScope()) { var holiday = _holidayRepository.GetById(request.Id); DomainEvents.Register <HolidayUpdatedEvent>(HolidayUpdated); holiday.Update(request.Start, request.End); session.Flush(); transactionScope.Complete(); } } finally { CurrentSessionContext.Unbind(_sessionFactory); DomainEvents.ClearCallbacks(); session.Dispose(); } }
public void SetCompleted(List <TodoListItem> items) { if (!items.All(item => item.ListId == Id) || items.Count == 0) { return; } var itemsCompleted = items.All(item => item.Completed); if (Completed && !itemsCompleted) { Completed = false; DomainEvents.Add(new TodoListCompletedStateChanged { List = this }); } else if (!Completed && itemsCompleted) { Completed = true; DomainEvents.Add(new TodoListCompletedStateChanged { List = this }); } }
public void Update(string comment, int rating) { Comment = comment; Rating = rating; DomainEvents.Add(new RateCreatedEvent(Id, GameId, Rating, Comment)); }
private async Task UpdatePlaylistForEveryoneInPartyAsync(Party party, PartyGoer partyGoer) { var seeds = party.GetSeedUris(5); await DomainEvents.RaiseAsync(new QueueEnded { PartyCode = party.GetPartyCode(), SeedTracksUris = seeds.Item1, SeedArtistUris = seeds.Item2 }); }
public MappingsSourceViewModel() { Mappings = new MappingsCollection(); DomainEvents.Register <MappingViewSelected>(HandleViewSelected); }
public static void Init() { SessionFactory.Init(ConfigurationManager.ConnectionStrings["DDDInPractice"].ConnectionString); HeadOfficeInstance.Init(new HeadOfficeRepository()); DomainEvents.Init(); }
public void Initialize() { DomainEvents.Register <CallStatusChanged>(CallStatusChanged); busylightAdapter.TurnBlue(); }
public async Task <int> Load(Guid extractId, int found, bool diffSupport) { int count = 0; var mapper = diffSupport ? ExtractDiffMapper.Instance : ExtractMapper.Instance; try { DomainEvents.Dispatch( new MnchExtractActivityNotification(extractId, new DwhProgress( nameof(MnchLabExtract), nameof(ExtractStatus.Loading), found, 0, 0, 0, 0))); StringBuilder query = new StringBuilder(); query.Append($" SELECT s.* FROM {nameof(TempMnchLabExtract)}s s"); query.Append($" INNER JOIN PatientMnchExtracts p ON "); query.Append($" s.PatientPK = p.PatientPK AND "); query.Append($" s.SiteCode = p.SiteCode "); const int take = 1000; var eCount = await _tempMnchLabExtractRepository.GetCount(query.ToString()); var pageCount = _tempMnchLabExtractRepository.PageCount(take, eCount); int page = 1; while (page <= pageCount) { var tempMnchLabExtracts = await _tempMnchLabExtractRepository.ReadAll(query.ToString(), page, take); var batch = tempMnchLabExtracts.ToList(); count += batch.Count; //Auto mapper var extractRecords = mapper.Map <List <TempMnchLabExtract>, List <MnchLabExtract> >(batch); foreach (var record in extractRecords) { record.Id = LiveGuid.NewGuid(); } //Batch Insert var inserted = _mnchLabExtractRepository.BatchInsert(extractRecords); if (!inserted) { Log.Error($"Extract {nameof(MnchLabExtract)} not Loaded"); return(0); } Log.Debug("saved batch"); page++; DomainEvents.Dispatch( new MnchExtractActivityNotification(extractId, new DwhProgress( nameof(MnchLabExtract), nameof(ExtractStatus.Loading), found, count, 0, 0, 0))); } await _mediator.Publish(new DocketExtractLoaded("MNCH", nameof(MnchLabExtract))); return(count); } catch (Exception e) { Log.Error(e, $"Extract {nameof(MnchLabExtract)} not Loaded"); return(0); } }
public void Register(Student student) { RegisteredStudents.Add(student); DomainEvents.Raise(new NewStudentRegistrationEvent(student, this)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var applicationLifetime = app.ApplicationServices.GetRequiredService <IApplicationLifetime>(); applicationLifetime.ApplicationStopping.Register(OnShutdown); _windsorContainer.GetFacility <AspNetCoreFacility>().RegistersMiddlewareInto(app); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error/Error"); } var unitOfWorkMode = AppSettings.Configuration["UnitOfWorkMode"]; switch (unitOfWorkMode) { case "TransactionScopeUnitOfWork": _setupTransactionScopeUnitOfWork(); break; case "UnitOfWork": _setupUnitOfWorkWithDelayedDomainEventHandling(); break; default: throw new NotSupportedException("Unsupported unit of work mode."); } var pathBase = AppSettings.Configuration["PathBase"]; if (!string.IsNullOrWhiteSpace(pathBase)) { app.UsePathBase(pathBase); } app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); _ConfigureBus(_windsorContainer); _UpgradeDatabase(); void _setupTransactionScopeUnitOfWork() { _windsorContainer.Register( Component.For <TransactionScopeUnitOfWorkMiddleware>() .DependsOn(Dependency.OnValue <System.Transactions.IsolationLevel>( System.Transactions.IsolationLevel.ReadCommitted )) .DependsOn(Dependency.OnValue <Action <System.Transactions.TransactionScope> >( (Action <System.Transactions.TransactionScope>)(transactionScope => transactionScope.EnlistRebus()) )) .LifestyleSingleton().AsMiddleware() ); DomainEvents.Initialize(_windsorContainer.Resolve <IDomainEventHandlerFactory>()); } void _setupUnitOfWorkWithDelayedDomainEventHandling() { _windsorContainer.Register( Component.For <UnitOfWorkMiddleware>() .DependsOn(Dependency.OnValue <IsolationLevel>(IsolationLevel.ReadCommitted)) .LifestyleSingleton().AsMiddleware() ); DomainEvents.Initialize( _windsorContainer.Resolve <IDomainEventHandlerFactory>(), isDelayedDomainEventHandlingEnabled: true ); } }
private static void DomainEvents_AsyncDomainEventHandlerExecuted(DomainEvents.IDomainEvent domainEvent, DomainEvents.IAsyncDomainEventHandler asyncDomainEventHandler) { try { SessionFactoryManager.Current.CommitTransaction(); LiteFx.DomainEvents.DomainEvents.DispatchAsyncEvents(); } catch (Exception ex) { DomainEvents.DomainEvents.OnAsyncDomainEventHandlerError(ex, domainEvent, asyncDomainEventHandler); SessionFactoryManager.Current.RollbackTransaction(); throw; } finally { SessionFactoryManager.Current.DisposeSession(); } }
public async Task <int> Extract(DbExtract extract, DbProtocol dbProtocol) { int batch = 500; DomainEvents.Dispatch(new MgsNotification(new ExtractProgress(nameof(MetricMigrationExtract), "extracting..."))); //DomainEvents.Dispatch(new CbsStatusNotification(extract.Id,ExtractStatus.Loading)); var list = new List <TempMetricMigrationExtract>(); int count = 0; int totalCount = 0; using (var rdr = await _reader.ExecuteReader(dbProtocol, extract)) { while (rdr.Read()) { totalCount++; count++; // AutoMapper profiles var extractRecord = Mapper.Map <IDataRecord, TempMetricMigrationExtract>(rdr); extractRecord.Id = LiveGuid.NewGuid(); list.Add(extractRecord); if (count == batch) { // TODO: batch and save _extractRepository.BatchInsert(list); try { DomainEvents.Dispatch(new MgsNotification(new ExtractProgress(nameof(MetricMigrationExtract), "extracting...", totalCount, count, 0, 0, 0))); } catch (Exception e) { Log.Error(e, "Notification error"); } count = 0; list = new List <TempMetricMigrationExtract>(); } // TODO: Notify progress... } if (count > 0) { _extractRepository.BatchInsert(list); } _extractRepository.CloseConnection(); } try { DomainEvents.Dispatch(new MgsNotification(new ExtractProgress(nameof(MetricMigrationExtract), "extracted", totalCount, 0, 0, 0, 0))); DomainEvents.Dispatch(new MgsStatusNotification(extract.Id, ExtractStatus.Found, totalCount)); DomainEvents.Dispatch(new MgsStatusNotification(extract.Id, ExtractStatus.Loaded, totalCount)); } catch (Exception e) { Log.Error(e, "Notification error"); } return(totalCount); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { //ServiceProvider = serviceProvider; app.UseResponseCompression(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseCors( builder => builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials()) .UseStaticFiles() .UseWebSockets(); app.Use(async(context, next) => { await next(); if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value) && !context.Request.Path.Value.StartsWith("/api/")) { context.Request.Path = "/index.html"; await next(); } }); app.UseMvcWithDefaultRoute(); app.UseDefaultFiles(); app.UseStaticFiles() .UseSwaggerUi(); var hfServerOptions = new BackgroundJobServerOptions() { ServerName = $"dwapi", WorkerCount = Environment.ProcessorCount * 5, Queues = new string[] { "mpi", "default" } }; app.UseHangfireDashboard(); app.UseHangfireServer(hfServerOptions); GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute() { Attempts = 3 }); Log.Debug(@"initializing Database..."); EnsureMigrationOfContext <SettingsContext>(serviceProvider); EnsureMigrationOfContext <ExtractsContext>(serviceProvider); app.UseSignalR( routes => { routes.MapHub <ExtractActivity>($"/{nameof(ExtractActivity).ToLower()}"); routes.MapHub <CbsActivity>($"/{nameof(CbsActivity).ToLower()}"); routes.MapHub <HtsActivity>($"/{nameof(HtsActivity).ToLower()}"); routes.MapHub <DwhSendActivity>($"/{nameof(DwhSendActivity).ToLower()}"); routes.MapHub <CbsSendActivity>($"/{nameof(CbsSendActivity).ToLower()}"); routes.MapHub <HtsSendActivity>($"/{nameof(HtsSendActivity).ToLower()}"); } ); Mapper.Initialize(cfg => { cfg.AddDataReaderMapping(); cfg.AddProfile <TempExtractProfile>(); cfg.AddProfile <TempMasterPatientIndexProfile>(); cfg.AddProfile <EmrProfiles>(); cfg.AddProfile <TempHtsExtractProfile>(); } ); DomainEvents.Init(); try { DapperPlusManager.AddLicense("1755;700-ThePalladiumGroup", "2073303b-0cfc-fbb9-d45f-1723bb282a3c"); if (!Z.Dapper.Plus.DapperPlusManager.ValidateLicense(out var licenseErrorMessage)) { throw new Exception(licenseErrorMessage); } } catch (Exception e) { Log.Debug($"{e}"); throw; } Log.Debug(@"initializing Database [Complete]"); Log.Debug( @"---------------------------------------------------------------------------------------------------"); Log.Debug (@" _____ _ | __ \ (_) | | | |_ ____ _ _ __ _ | | | \ \ /\ / / _` | '_ \| | | |__| |\ V V / (_| | |_) | | |_____/ \_/\_/ \__,_| .__/|_| | | |_| "); Log.Debug( @"---------------------------------------------------------------------------------------------------"); Log.Debug("Dwapi started !"); }
private static void DomainEvents_AsyncDomainEventHandlerError(Exception exception, DomainEvents.IDomainEvent domainEvent, DomainEvents.IAsyncDomainEventHandler asyncDomainEventHandler) { SessionFactoryManager.Current.RollbackTransaction(); SessionFactoryManager.Current.DisposeSession(); }