Hello, in this source code below, the class already inherits from MyTestsDomainServiceBase, hence, all methods are handled automatically by UOW.
Why the code still adds an attribute [UnitOfWork], is it necessary in this case?
Thanks
public class FriendshipManager : MyTestsDomainServiceBase, IFriendshipManager
{
private readonly IRepository<Friendship, long> _friendshipRepository;
public FriendshipManager(IRepository<Friendship, long> friendshipRepository)
{
_friendshipRepository = friendshipRepository;
}
[UnitOfWork]
public void CreateFriendship(Friendship friendship)
{
if (friendship.TenantId == friendship.FriendTenantId &&
friendship.UserId == friendship.FriendUserId)
{
throw new UserFriendlyException(L("YouCannotBeFriendWithYourself"));
}
using (CurrentUnitOfWork.SetTenantId(friendship.TenantId))
{
_friendshipRepository.Insert(friendship);
CurrentUnitOfWork.SaveChanges();
}
}
Thank you.
So basically defining a Notification Type helps in many things: 1- Users can unsubscribe to notification types 2- Permission can be given for the notification type, who can see this notification or not
Regards Bilal
Thank you. I read this document.
Is it implemented by default for Web APIs or I have to write the code to use it? Do I need to change how users login, etc. ?
Thanks
Hello,
Is the Abp Source code available to view? I have a technical curiosity to see how some of the nice features are developed.
Thank you, Bilal
Hi,
I got the Admin for the Default tenant locked out. I don't know why this happened. How to fix that?
Thanks Bilal
Hello,
Is there an example of using CacheManager in an AppService to see how to save/get data?
Thanks
Hi,
I noticed that the application is configured to use Bearer Tokens.
What else I need to configure so that WebAPI calls could make use of those tokens on mobiles instead of cookies?
Thanks, Bilal
How come one of the notifications the "welcome" is not defined before used? Can we do this? If a notification type is not defined then when publishing we can limit it for a tenant(s) or user(s)?
also, if the application sends a notification while user is logged in, it will popup? Or how?
thanks
Yes, thanks a lot.
So, if I define a new Notification Type NN with a Permission X, then if I add the Permission X to Group Users, then any member of this group would receive notifications of type NN?
One more thing, when subscribing to notification types, is this information stored in the database? So, if the application publishes several notifications, then when the user logins with appropriate permissions, he/she will be able to see all collected notifications?
For instance,
//Notifications
await _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync(user.ToUserIdentifier());
This means that somewhere in the DB, the newly registered user, is now subscribed to all notifications that this uer's role/group has permission for?
Also, in this code:
public async Task WelcomeToTheApplicationAsync(User user)
{
await _notificationPublisher.PublishAsync(
AppNotificationNames.WelcomeToTheApplication,
new MessageNotificationData(L("WelcomeToTheApplicationNotificationMessage")),
severity: NotificationSeverity.Success,
userIds: new[] { user.ToUserIdentifier() }
);
}
The Notification Type "WelcomeTpTheApplication" is published and targeting specific users, correct? So, given the first call above, this means, the user is now subscribed to receive this notification correct?
Also, I read somewhere in the documentation, a notification type should be registered before it is being used. In this case, I don't see anywhere in the code where this specific notification type is registered?
Also, since the code subscribes a newly registered user to all notifications that users have permission on, so my custom code can simply publish notifications and I don't need to worry about how to pass the notifications to users, this is done automatically by the framework given of course this line of code:
//Notifications
await _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync(user.ToUserIdentifier());
Finally, are notifications stored in the DB? When he/she logs in, then all notifications that were published before, would now load for the user to see?
Many thanks