How can I prevent or suppress the 'ajax request did not succeed' error popup? It happens when a user forces a refresh
I can use the cache successfully like this:-
var members = _cacheManager .GetCache("MembersCache") .Get("Members", () => GetMembersFromDatabase(input.ParentCompanyId)) as List<Customer>;
which calls this:- private List<Customer> GetMembersFromDatabase(int ParentCompanyId) { return _customerRepository.GetAllList(x => x.ParentCompanyId == ParentCompanyId); }
I've set the timeout to 15 mins. The problem is, after 15 minutes it returns no results. I would have expected it to start calling the GetMembersFromDatabase function again to get fresh data, but it doesn't Where am I going wrong?
If its the log4net file thats locking, I had the same problem. You can get around it by adding this line to log4net.config before the </appender> line:-
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
Hi, Following your new example documents, I can add signalr and publish/subscribe to a simple notification. And I can see in browser Console that signalR is connected and registered.
However if I add this to header.js:-
abp.event.on('abp.notifications.received', function (userNotification) {
console.log("notification!", userNotification);
});
... nothing fires. I can see the notification and subscriptions being added to the SQL tables, but still nothing fires on the client side. In the logs I get the error "There is no notification definition with given name: CustomerCreated".
This is how I subscribe:-
await _notificationSubscriptionManager.SubscribeAsync(1, 3, "CustomerCreated");
And this is how I publish:-
public async Task Publish_CustomerCreated(string CustomerName, int CustomerId)
{
var data = new LocalizableMessageNotificationData(new LocalizableString("CustomerCreatedMessage", "BlueHarvest"));
data["CustomerName"] = CustomerName;
data["CustomerId"] = CustomerId;
await _notificationPublisher.PublishAsync("CustomerCreated", data, severity: NotificationSeverity.Warn);
}
Not quite what I meant.... What I mean is... when I've added an Entity with automatic audit fields (e.g. CreatorUserId, CreationTime, etc.) I can see how to access those fields in the app service and pass them through to the client.
But how do get the corresponding username for that userid? Do I need to access UserManager, and if so - how?
What is the recommended way to return the full username all the to the client (angular) when using FullAuditedEntity ? e.g. get the full user name from the CreatorUserId
I have created a Customer entity...
[Required]
public string Name {get;set;}
public virtual ICollection<Document> Documents { get; set; }
public Customer()
{
Documents = new HashSet<Document>();
}
... which as you can see each contain Document collections...
[Required]
public string Type {get;set;}
public virtual int CustomerId { get; set; }
[ForeignKey("CustomerId")]
public virtual Customer Customer { get; set; }
And in my DTOs I just declare and set the CustomerId... (not the virtual Customer - this seems to be how you do it in the SimpleTaskSystem example)...
public class CreateDocumentInput : IInputDto
{
[Required]
public string Type {get;set;}
public in CustomerId {get;set;}
}
public void CreateDocument(CreateDocumentInput input)
{
var document = new Document
{
Type = input.Type,
CustomerId = input.CustomerId
};
}
I've written application services that read and write to both these entities. This all works fine UNTIL I start adding Document entities, and then the original GetCustomers web service call fails with a 500 internal server error. It seems to be because I have added related Documents to the Customer and it is having problems getting the data. Where am I going wrong? I've read outside of ABP that this can happen with lazy loading. Adding this line to DBContext prevents the error:-
this.Configuration.ProxyCreationEnabled = false;
But I don't want to break the benefits of ABP...
What is the correct way to share data from a service without re-retrieving the data each time?
For example, I have created a getCustomers service. But I want to use the data in both a header controller, and in the controller for a particular page.
At present this results in separate calls to the service each time - but I would like to just retrieve the data once and make it available globally.
Well, for future civilizations, here's how I did it.
Added userRepository to the constructor in UserStore.cs:-
_userRepository = userRepository;
And added a function to retrieve the list asyncronously:
public async Task<List<User>> GetAllUsersAsync()
{
return await _userRepository.GetAllListAsync();
}
Then you can get to it via an app service:-
public async Task<GetAllUsersOutput> GetAllUsers()
{
return new GetAllUsersOutput
{
Users = Mapper.Map<List<UserDto>>(await _userStore.GetAllUsersAsync())
};
}
And use angular...
vm.users = [];
userService.getAllUsers().success(function (data) {
vm.users = data.users;
});
... to display it in a view:-
<select ng-model="vm.users.name" ng-options="user.id as user.name for user in vm.users">
<option value=""></option>
</select>
How can I retrieve a list of AbpUsers users, preferably async? For example, to populate a dropdown list of users to assign a task to. I've tried using UserManager _userManager but it only seems relevant to finding or retrieving one users' details at a time. Is there an IQueryable collection of users? I'd like to be able to then filter that list based on roles
:roll: