But if i call service directly fron view doesnt work since onexception method overrided in base controller.
Thanks worked.
So no filter attribute class added, only overrided OnException method. ;)
try catch and UserFriendlyException method is ok. But as BBakerMMC said, we must wrap everything in tyr catch.
So i tried new exception filter attribute. (we are working with mvc, not mvc core) I added this new class to Application Project. Bu when i debug, i saw that not enter OnException method.
I want to handle new exception types, as done for AbpAuthorizationException, AbpValidationException ...
I mean, for ex when an exception about delete conflict occurs, i want to handle it and show specific message to user. (for ex: "You cant delete this record. Because it has been used") But now this delete conflict hasn't been handled, default message is shown to the user.
How can i do this?
Its type is "IRepository<AnnounceEntity>"
This is the part of my Update service method.
public async Task UpdateAnnouncement(EditAnnouncementInputDto input) { var announce = input.MapTo<AnnounceEntity>();
_announceRepository.As<EfRepositoryBase<MyProjectDbContext, AnnouncementEntity>>().Table.Attach(announce);
await _duyuruRepository.UpdateAsync(announce);
}
Ofc not :)
Thank you for your reply and patience (:
I solved reference and using problems. But when code comes to this line
repository.As<EfCoreRepositoryBase<MyDbContext, AnnouncementEntity>>().Table.Attach(announce);
Unable to cast object of type 'Castle.Proxies.IRepository1Proxy_4' to type 'Abp.EntityFramework.Repositories.EfRepositoryBase
2[ProjectName.EntityFramework.MyDbContext,AnnouncementEntity]'
Thank you for your reply.
I understand that i should attach the entity to the DbContext.
But i cant figure it out how.
Could you be more specific with this line:
repository.As<EfCoreRepositoryBase<MyDbContext, AnnouncementEntity>>().Table.Attach(announce);
Btw im not using EfCore.
my _announcementRepo doesnt have "As" method.
Hi there, I have an simple entity like that
public class AnnouncementEntity { public int Id { get; set;} public string Header {get; set;} public string Content {get; set;} }
In my application service i have an update method: public async Task UpdateAnnouncement(EditAnnouncementInputDto input) {
AnnouncementEntity announce = new AnnouncementEntity()
{
Id = input.Id,
Header = input.Header
};
await _announceRepository.UpdateAsync(announce);
}
this method updates the entity but i have a Content column and this update makes Content NULL.
How can i update columns that i want not all columns?