Base solution for your next web application

Activities of "corneduplooy"

Hi,

Is it possible to show a custom unauthorized page rather than redirecting to the login page if an unauthorized action is called.

Ive tried added a custom error to web.config for 401 errors, but the response status returns as 302.

Regards.

Hi,

Im running into the following error when trying to update an entity:

Attaching an entity of type 'ITFM.CostAccount' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.

This started happening after moving my code from Application Service (*.Application project) to a Domain Service (ObjectManager in *.Core project).

I have noticed though that this only happens after a retrieve a list of the stored objects before trying to update the object passed into the function as a DTO.

So to make it a bit clearer, a simple version of my code is

public async Task<TaskResult> UpdateDto(CostAccountDto value) {

List<CostAccount> storedAccounts = await _costAccountRepository.GetAllListAsync() //IRepository<CostAccount> using Dependency Injection

await _costAccountRepository.Update(value.MapTo<CostAccount>()); }

If I do not call the GetAllListAsync function on the repository, the update commits without an error.

Can you assist in resolving this.

REgards, Corne du Plooy

Showing 1 to 2 of 2 entries