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.
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.
Controller: HastaTakip, Action: MuayeneModal
var _muayeneModal = new app.ModalManager({
modalId: "modalMuayene",
viewUrl: abp.appPath + 'Mpa/HastaTakip/MuayeneModal',
modalClass: 'MuayeneModal',
modalData: hastaId
});
_muayeneModal.open();
It is ok : "Abp.Authorization.AbpAuthorizationException: Required permissions are not granted. At least one of these permissions must be granted: *** "
But message shown on alert is like "an internal error occured during your request"