Base solution for your next web application

Activities of "imad"

Hi,

After further testing, if i remove the permissionDependency from my NotificationDefinition, I successfully receive the notification, although I am sure that the current user has the required permission when i enable the permission dependency the notification is not sent.

If the assigned permissions has multiTenancySides it will not work, if i remove the multiTenancySides on permission creation the notification is sent.

Hope this will help with the troubleshooting. Thank you.

Hi,

This is the first point i suspected, but as you can see step N-5 there is one users subscribed to this event.

and here is the table AbpNotificationSubscriptions UserId NotificationName 2 App.NewDataSourceCreated 2 App.UserSignedIn 2 App.NewUserRegistered 2 App.NewDataProjectCreated 2 App.NewDashboardCreated

I am successfully receiving notification for App.UserSignedIn because its defined in the Core module AppNotifier.

And Sorry i cant share my project. Thank you.

Any Help, or guidance? is this a bug or i am missing something in the steps?

Hi I am using version 2.0.1,

While looking at the profiler, i see the following execution queries:

1.INSERT [dbo].[AbpNotifications] 2.INSERT [dbo].[AbpBackgroundJobs] 3.Select FROM [dbo].[AbpBackgroundJobs] 4.Select FROM [dbo].[AbpNotifications] 5.Select FROM [dbo].[AbpNotificationSubscriptions] (returns 1 row) 6.DELETE [dbo].[AbpNotifications] 7.DELETE [dbo].[AbpBackgroundJobs]

There is no insert into AbpTenantNotifications or AbpUserNotifications where others notifications usually are.

Thank you.

Question

Hi,

I need to send a notification from an ApplicationService defined in a custom module, I successfully managed to add a new notification type to the default AppNotificationProvider defined in the core module, but when I try to replicate the same in another module the notification wont show up, even its not save in the database.

So in my custom module i have the following:

  1. Defined a new NotificationProvider and registered it to Configuration.Notifications.Providers in module PreInitialize, its now successfully shown in the list of available notification to the user in Notification Settings. 2.Defined a new AppNotifier similar to the one in the core module that uses the _notificationPublisher.PublishAsync 3.From my custom application service i invoke await _appNotifier.NewDataProjectCreatedAsync(dataProject);

I got no error and yet the notification is not saved in the database and of course not sent to the client, even the user is subscribed to this type of notification.

What i am missing do i need to call _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync before i invoke the method on appNotifier like in the AccountController?

Thank you.

Question

Hi,

How to achieve Dto inheritence in order for base and derived class map correctly to their correspondent Dto?

in the following example, i am always getting the ProductDto even if the product is a ProductA instance, how to make it map to ProductADto?

public class Product {}
public class ProductA : Product {}

[AutoMap(typeof(Product)]
public class ProductDto {}

[AutoMap(typeof(ProductA)]
public class ProductADto {}

public class GetProductForEditOutput
{
public Product EditProduct { get; set; }
}
Answer

Hi,

I ended up overriding the CancelDeletionForSoftDelete in my dbContext:

protected override void CancelDeletionForSoftDelete(System.Data.Entity.Infrastructure.DbEntityEntry entry)
        {
            if (!this.CurrentUnitOfWorkProvider.Current.IsFilterEnabled(Abp.Domain.Uow.AbpDataFilters.SoftDelete))
            {
                return;
            }

            base.CancelDeletionForSoftDelete(entry);
        }
Answer

Hi,

Changing the scope to RequiresNew, solved the problem and i am getting the same behavior as if i am executing in a default app service methods. My objects are using foreign keys with cascadedelete so the delete is automatically handled by EF.

Is there any possible way to disable the SoftDelete filter while executing a delete to do a physical delete (check the second part of my question)?

Thank you.

Question

Hi,

In my application service i need to connect to an external database using ODBC, this database provider doesn't support transaction, and it causing problem with the default transnational nature of application service methods.

The solution was to add the [UnitOfWork(IsDisabled = true)] attribute and define my own scope for the code part that needs to interact with the SQL server database using UnitOfWorkManager.Begin() method. However the behavior I am getting is different if I execute the SQL server part alone in an application service methods.

What I Have so far:

[UnitOfWork(IsDisabled = true)]
public async Task DeleteObject(DeleteObjectInput input){
    //connect to external engine

    //perform SQL server logic
    var unitOfWorkOptions = new UnitOfWorkOptions() { IsTransactional = true };
    unitOfWorkOptions.FilterOverrides.Add(new DataFilterConfiguration(AbpDataFilters.SoftDelete, false));
    using (var unitOfWork = UnitOfWorkManager.Begin(unitOfWorkOptions))
    {
        var object = await _objectRepository.GetAsync(input.Id);
       //perform some logic
        await _objectRepository.DeleteAsync(object );
        await unitOfWork.CompleteAsync();
    }
}

The object class has a List of other sub-objects and a one to one relation with another extend-object. When i execute the above code only the object is marked as deleted and the dependent objects are intact, while if i execute the same code directly in an application service methods all the dependent object are marked as deleted.

Another point, I assume disabling the SoftDelete filter is enough to completely remove the objects from the database, which is not the case (apparently it works only on the select), do I need to execute a raw SQL query to achieve this behavior?

Thank you.

Hi,

In my application service, I need to send additional data to the client when I throw UserFriendlyException, so I created my own exception class that inherit UserFriendlyException and added my own custom properties.

However on the client side, when calling the application service method, I am unable to get the new custom properties added, do i need to register my custom exception somewhere?

Also on the client side and based on the error code thrown, i need to provide my own handling and prevent the default error message that appears, how to cancel this behavior based on error code.

ex:

vm.save = function () { vm.saving = true; appService.update(vm.entity) .then(function () { abp.notify.info(app.localize('SavedSuccessfully')); $uibModalInstance.close(); }, function (result) { <ins>//I want to cancel the default error message and show my own handling with the new custom properties</ins> vm.saving = false;
}).finally(function () { vm.saving = false; }); };

Showing 1 to 10 of 13 entries