skip to Main Content

Return specific error based on exception in ASP.NET Core?

Consider a controller endpoint like this: [HttpGet] public IActionResult Get() { var resource = _myService.GetSomeResource(); return Ok(resource); } The GetSomeResource() method performs validation on the identity of the caller, like this: public SomeResourceModel GetSomeResource() { _securityVerifier.VerifyCallerHasAccess(); // do stuff to…

VIEW QUESTION

Add Migration with asp.net web API

PM> Add-Migration InitialCreate Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.P rojectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:UsersCtop.nugetpackagesentityframework6.0.0toolsEntityFramework.psm1 :609 char:5 + $domain.SetData('project', $project) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException +…

VIEW QUESTION
Back To Top
Search