@alper, that is just what I needed. I will go through the links and try implement. If there is a short and sweet solution I will post it here.
Previous title: Notifications
I add the notification to AppNotificationNames:
public const string DataProviderUpdateCompleted = "App.DataProviderUpdateCompleted";
I then add the notification to AppNotificationProvider:
context.Manager.Add(
new NotificationDefinition(
AppNotificationNames.DataProviderUpdateCompleted,
displayName: L("DataProviderUpdatedNotificationDefinition"),
permissionDependency: new SimplePermissionDependency(AppPermissions.Pages_Administration_Users)
)
);
I then add a message to my localization file:
<text name="DataProviderUpdatedNotificationMessage"><![CDATA["Database updated from data provider:</br>updated; {entitiesUpdated} </br>added; {entitiesAdded} </br>moved; {entitiesMoved}."]]></text>
The notification displays fine as html but the row in the notifications grid displays text and not html (as does the notification on my desktop):
Database updated from data provider:</br>updated; 0 </br>added; 0 </br>moved; 0.
The question is:
How do I universally format notifications?
dotnet-core, angular, 5.4.1 What's the position with regard to the Hangfire dashboard in the above configuration? I seem to remember that it's not possible to get it working because _Hangfire_uses cookies. Is this true or is there a simple way to get the _Hangfire_dashboard working?
Anyone - best practices for integrating Hangfire in dotnet-core, angular version. Follow the instructions at [https://aspnetboilerplate.com/Pages/Documents/Hangfire-Integration]). Normally in an MVC project I place this in StartUp.cs:
Services.Hangfire.ConfigureHangfire(app);
And then in my services layer I would place the service:
public class Hangfire
{
public static void ConfigureHangfire(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");
//see https://blog.entelect.co.za/view/7580/dependency-injection-with-hangfire
var hangfireContainer = new UnityContainer();
GlobalConfiguration.Configuration.UseActivator(new UnityJobActivator(hangfireContainer));
app.UseHangfireServer();
app.UseHangfireDashboard("/backgroundjobs", new DashboardOptions
{
Authorization = new[] { new HangfireAuthorization() }
});
if (ConfigurationManager.AppSettings["IsProduction"] == "true")
{
InitializeJobs();
}
}
public static void InitializeJobs()
{
//place any recurring jobs here....
RecurringJob.AddOrUpdate<Services.Workers.RebuildCoursesAndEventsJob>(job => job.Execute(), "0 7 * * *");
}
}
public class HangfireAuthorization : IDashboardAuthorizationFilter
{
public bool Authorize([NotNull] DashboardContext context)
{
if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
{
var authorized = (HttpContext.Current.User.IsInRole("Developer") || HttpContext.Current.User.IsInRole("Admin"));
return authorized;
}
return false;
}
}
And RebuildCoursesAndEventsJob would be run as follows (note: the system uses CQS):
public class RebuildCoursesAndEventsJob
{
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private ICommandHandler<RebuildCoursesAndEventsCommand> _rebuildCoursesAndEvents;
public RebuildCoursesAndEventsJob(
ICommandHandler<RebuildCoursesAndEventsCommand> rebuildCoursesAndEvents)
{
_rebuildCoursesAndEvents = rebuildCoursesAndEvents;
}
public void Execute()
{
logger.Info("executing job: " + DateTime.Now.ToShortTimeString(), null);
using (DomainContext _db = new DomainContext())
{
var service = new RebuildCoursesAndEventsCommand();
_rebuildCoursesAndEvents.Handle(service);
return;
}
}
}
Now how the hell would I do that in Zero? I get the part about not being able to use the dashboard because of MVC's cookies. I'm not sure how Castle works, I had to create a UnityContainer for Hangfire when placing it in my service project in MVC as the code above shows. So the question is;
what do I place in my Startup.cs to fire the service, where do I put my service, where do I place my workers (jobs) and what code do I need to make it all work with Zero and Castle?
Makes perfect sense, thanks.
Hi Aaron,
Just to be clear, I add the following lines to ProjectnameEntityFrameworkCoreModule (I am tracking history for all fully audited entities):
Configuration.EntityHistory.IsEnabled = true; //Enable this to write change logs for the entities below:
Configuration.EntityHistory.Selectors.Add("NuagecareEntities", typeof(OrganizationUnit), typeof(Role), typeof(User), typeof(Tenant));
Configuration.EntityHistory.Selectors.Add(
new NamedTypeSelector(
"Abp.FullAuditedEntities",
type => typeof(IFullAudited).IsAssignableFrom(type)
));
Can you tell what the following lines are for in AuditLogAppService and do I need to change anything?
public List<NameValueDto> GetEntityHistoryObjectTypes()
{
var entityHistoryObjectTypes = new List<NameValueDto>();
if (AbpSession.TenantId == null)
{
entityHistoryObjectTypes.Add(new NameValueDto(L("Nuagecare.MultiTenancy.Tenant"), "Nuagecare.MultiTenancy.Tenant"));
}
entityHistoryObjectTypes.Add(new NameValueDto(L("Nuagecare.MultiTenancy.Role"), "Nuagecare.MultiTenancy.Role"));
entityHistoryObjectTypes.Add(new NameValueDto(L("Abp.Organizations.OrganizationUnit"), "Abp.Organizations.OrganizationUnit"));
return entityHistoryObjectTypes;
}
Thanking you in advance....
After you ran the migrator tool did you start the project with the settings pointed to your Azure database to populate the data?
asp-core, angular: 5.4.1 Hey guys,
I followed the instructions at [https://medium.com/volosoft/devextreme-asp-net-zero-integration-444ea26d0fc5]) to implement a couple of DevExtreme components a while back on 5.1.0. It is worth noting that as of Angular 6 the instructions for implementation of DevExtreme in Angular 6 and above have changed. Therefore your blog will not work with 5.4.0 and above.
Instead of adding the following lines to your .angular-cli.json file:
"../node_modules/devextreme/dist/css/dx.common.css",
"../node_modules/devextreme/dist/css/dx.light.css",
One should instead add the following lines to your angular.json file:
"node_modules/devextreme/dist/css/dx.common.css",
"node_modules/devextreme/dist/css/dx.light.css",
This is as per their instructions at the following address: [https://github.com/DevExpress/devextreme-angular/blob/master/docs/using-angular-cli.md#configuration]). You may want to update the blog to save irrelevant issues being posted to github which seems to have replaced your forum as the go-to "can you help me with..." site.
Doh! Thanks, Aaron. But I'm sure i saw a post whereby auditability had been switched on by default.
.Net core, angular, 5.4.0 I download the new version and set up as per instructions. I login as the default tenant and add a new Organization Unit. I go to Audit Logs and can see the Operation for CreateOrganizationUnit in the Operation log tab. I switch tabs to Change logs and can not see the creation, I select the admin user and the OrganizationUnit entity and can still not see any changes. I update the Organization Unit and return to the Audit Log -> Change log tab and can still not see any changes.
Am I missing something?