Hi @ismcagdas
It makes perfect sense now :)
Thank you for that.
Hi,
I'd like to ask how is that achieved in Abp that without adding controllers or routes it is possible to serve .cshtml files to client like '/App/Main/views/tenants/index.cshtml' Or in fact it does something similar to dynamic web api controller builder ?
I'm really curious and it would be handy to know how to apply it to projects that can not use Abp.
Hi,
I believe that you'll need to to use INotificationDistributer to distribute notifications and then assert your test. Check this [https://github.com/aspnetboilerplate/aspnetboilerplate/blob/11f2a25119c0447b0581172cd6aa9c3ee67d916f/src/Abp/Notifications/NotificationDistributer.cs]) So when you publish notification it's going to be saved as TenantNotification and then publisher saves them as UserNotifications during actual publish.
Hi,
I'm using IEmailSender with success which in turn by default uses SmtpEmailSender. In my case added email functionality to existing notification infrastructure.
Check this [https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Net/Mail/EmailSettingProvider.cs]) and [https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Net/Mail/Smtp/SmtpEmailSender.cs])
All I had to do to get emails to work was to override some of default settings.
_settingManager.ChangeSettingForApplication(EmailSettingNames.Smtp.Host, "");
_settingManager.ChangeSettingForApplication(EmailSettingNames.Smtp.UserName, "");
_settingManager.ChangeSettingForApplication(EmailSettingNames.Smtp.Password, "");
_settingManager.ChangeSettingForApplication(EmailSettingNames.DefaultFromAddress, "");
_settingManager.ChangeSettingForApplication(EmailSettingNames.DefaultFromDisplayName, "");
To create email content either in IApplicationService or anywhere else I created :
public interface IEmailParser
{
MailMessage Parse(TenantNotification notification);
}
And lastly I implemented IEmailParser in my Web project using Postal
https://github.com/andrewdavey/postal
Hope that helps
Hi,
Thank you very much for response it means a lot to me especially because when I started working with Abp my developing skills improved same as quality of my work and timings - it was most complex and at the same time very well structured - simply best working project I worked with so far. For me as for junior developer Abp is an example of top quality software which I want to follow and your github repo serves for me as a holly book- I love the patterns and techniques used :)
Hi,
I believe that IRepository.Get() method is meant to return exception if record was not found. You can use .FirstOrDefault() to do that. For example UserManager class has GetById and FindById methods where later works as you want.
Hi
Are you getting exception in regards of IRepository being disposed or is it coming from somewhere lover down the stack, like DbContext disposed exception?
I had issues before where my DbContext would be disposed but the reason for that was misusing the framework and not understanding UnitOfWork. Make sure when your code operates on DB that UnitOfWork is applied. [http://www.aspnetboilerplate.com/Pages/Documents/Unit-Of-Work])
Hope that helps
Hi,
Thank you very much for response. I was considering solution that you proposed and but I'm not sure how I could get detailed information using this approach. I need to get bit more detailed information about errors occurring in my workflows as well as possibility to execute within IApplicationService or as BackgroundJob.
In the end I got it to work in following way :
Changed implementation of workflows to handle exceptions internally (previously workflow could throw exceptions and were handled in my IApplicationService but I had to made it possible to execute the same workflow as background job)
Changed return type of my "Execute(input)" public method of workflow from void to WorkflowExecutionResult (WorkflowExecutionResult is used to return whether execution was successful or not and errors are passed as list of ValidationResult so I can use those to throw AbpValidationException in my IApplicationService if I want to display errors to client)
Last thing was making Workflow.Execute method to execute as Separate UoW transaction, I used - [UnitOfWork(TransactionScopeOption.RequiresNew)]. Originally that caused me problems and was the reason to start this post. I think what I was doing wrong was that my workflow classes are not implementing shared interface thus are not called over interface and with old signature which was public void Execute() method wasn't intercepted. Changing signature to virtual did the job.
Does it sound like valid solution? I hope I'm not missing something and wont try to fight against framework.
Hi,
I'm trying to execute some code as separate transaction inside UoW method. Basically I got IApplicationService which receives some order data and then selects appropriate workflow to execute. Workflows are created in a way so those can be easily turned into background job. but at the moment I'm executing them within my AppService method so there is already UoW applied right?
What I need to do now is to capture errors that are occurring and send email notification. I implemented email notifications using AbpNotifications. My problem is that I want to rollback all changes that were generated within workflow execution then publish notification and rethrow any errors from my workflow so those will be logged and displayed on UI.
Than you very much
Hi,
I found where the problem was, which was very silly btw.
I was passing EntityEntry object instead of actual entity. CheckMustHaveSourceAccountIdProperty(entry);
Should be like this CheckMustHaveSourceAccountIdProperty(entry.Entity);