Exception handling while deleting object in ASP.NET Core












-2















Basically I am decouple my code by introducing an Employee Repository to handle all the database interaction. My problem is that my code performs instruction but then throws




System.InvalidOperationException: 'Sequence contains no elements'.




I have tried using FirstOrDefault and SingelOrDefault as suggested but previous posts I've read but it performs the remove operation and throws




System.NullReferenceException: 'Object reference not set to an
instance of an object.'




removeEmployee was null. Can someone help explain to me how to fix it



This is the code I am trying to refactor and this initial code worked without throwing an exception:



[HttpPost]
public IActionResult Remove(int employeeIds)
{

foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employee.Remove(removeEmployee);
}
else
{
return Redirect("/Employee/Remove");
}

}
context.SaveChanges();
return Redirect("/");
}


Below is how I am trying to refactor my code.



Employee Repoistory:



 public bool RemoveEmployee(int employeeIds)
{
foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employees.Remove(removeEmployee);
}
else
{
return false;
}
}
context.SaveChanges();
return true;
}


Employee Controller:



private IEmployeesRepository repo;

public EmployeeController(IEmployeesRepository repo)
{
this.repo = repo;
}

[HttpPost]
public IActionResult Remove(int employeeIds)
{
repo.RemoveEmployee(employeeIds);

if (repo.RemoveEmployee(employeeIds) == false)
{
return Redirect("/Employee/Remove");
}
else
{
return Redirect("/");
}
}









share|improve this question




















  • 1





    here's your problem right here: Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

    – JohnB
    Nov 24 '18 at 1:38






  • 1





    See the docs, it returns InvalidOperationException when the predicated function yields 0 results and NullReferenceException if any of the items being evaluated are null. I am still reading the title part over to try to understand what you mean by "but still performs instructions".

    – Ross Bush
    Nov 24 '18 at 1:43













  • About the only way it could "still work" would be if you did the worst thing and swallowed the exceptions. Here are two articles on proper exception handling that I link quite often: blogs.msdn.microsoft.com/ericlippert/2008/09/10/… | codeproject.com/Articles/9538/…

    – Christopher
    Nov 24 '18 at 2:06











  • @RossBush the code does what I want it to do except that it throws the exception and crashes. it wouldn't remove/delete object from table if it null. my code worked perfectly well before I tried to refactor it. I just don't understand what I am doing wrong this time

    – iyke
    Nov 24 '18 at 2:28











  • @Christopher I understand exception handling could fix my problem. I just don't understand why the initial code works just fine without exception handling but the little change I made is breaking my code. Understanding what I am doing wrong is actually more important to me

    – iyke
    Nov 24 '18 at 2:33
















-2















Basically I am decouple my code by introducing an Employee Repository to handle all the database interaction. My problem is that my code performs instruction but then throws




System.InvalidOperationException: 'Sequence contains no elements'.




I have tried using FirstOrDefault and SingelOrDefault as suggested but previous posts I've read but it performs the remove operation and throws




System.NullReferenceException: 'Object reference not set to an
instance of an object.'




removeEmployee was null. Can someone help explain to me how to fix it



This is the code I am trying to refactor and this initial code worked without throwing an exception:



[HttpPost]
public IActionResult Remove(int employeeIds)
{

foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employee.Remove(removeEmployee);
}
else
{
return Redirect("/Employee/Remove");
}

}
context.SaveChanges();
return Redirect("/");
}


Below is how I am trying to refactor my code.



Employee Repoistory:



 public bool RemoveEmployee(int employeeIds)
{
foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employees.Remove(removeEmployee);
}
else
{
return false;
}
}
context.SaveChanges();
return true;
}


Employee Controller:



private IEmployeesRepository repo;

public EmployeeController(IEmployeesRepository repo)
{
this.repo = repo;
}

[HttpPost]
public IActionResult Remove(int employeeIds)
{
repo.RemoveEmployee(employeeIds);

if (repo.RemoveEmployee(employeeIds) == false)
{
return Redirect("/Employee/Remove");
}
else
{
return Redirect("/");
}
}









share|improve this question




















  • 1





    here's your problem right here: Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

    – JohnB
    Nov 24 '18 at 1:38






  • 1





    See the docs, it returns InvalidOperationException when the predicated function yields 0 results and NullReferenceException if any of the items being evaluated are null. I am still reading the title part over to try to understand what you mean by "but still performs instructions".

    – Ross Bush
    Nov 24 '18 at 1:43













  • About the only way it could "still work" would be if you did the worst thing and swallowed the exceptions. Here are two articles on proper exception handling that I link quite often: blogs.msdn.microsoft.com/ericlippert/2008/09/10/… | codeproject.com/Articles/9538/…

    – Christopher
    Nov 24 '18 at 2:06











  • @RossBush the code does what I want it to do except that it throws the exception and crashes. it wouldn't remove/delete object from table if it null. my code worked perfectly well before I tried to refactor it. I just don't understand what I am doing wrong this time

    – iyke
    Nov 24 '18 at 2:28











  • @Christopher I understand exception handling could fix my problem. I just don't understand why the initial code works just fine without exception handling but the little change I made is breaking my code. Understanding what I am doing wrong is actually more important to me

    – iyke
    Nov 24 '18 at 2:33














-2












-2








-2


1






Basically I am decouple my code by introducing an Employee Repository to handle all the database interaction. My problem is that my code performs instruction but then throws




System.InvalidOperationException: 'Sequence contains no elements'.




I have tried using FirstOrDefault and SingelOrDefault as suggested but previous posts I've read but it performs the remove operation and throws




System.NullReferenceException: 'Object reference not set to an
instance of an object.'




removeEmployee was null. Can someone help explain to me how to fix it



This is the code I am trying to refactor and this initial code worked without throwing an exception:



[HttpPost]
public IActionResult Remove(int employeeIds)
{

foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employee.Remove(removeEmployee);
}
else
{
return Redirect("/Employee/Remove");
}

}
context.SaveChanges();
return Redirect("/");
}


Below is how I am trying to refactor my code.



Employee Repoistory:



 public bool RemoveEmployee(int employeeIds)
{
foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employees.Remove(removeEmployee);
}
else
{
return false;
}
}
context.SaveChanges();
return true;
}


Employee Controller:



private IEmployeesRepository repo;

public EmployeeController(IEmployeesRepository repo)
{
this.repo = repo;
}

[HttpPost]
public IActionResult Remove(int employeeIds)
{
repo.RemoveEmployee(employeeIds);

if (repo.RemoveEmployee(employeeIds) == false)
{
return Redirect("/Employee/Remove");
}
else
{
return Redirect("/");
}
}









share|improve this question
















Basically I am decouple my code by introducing an Employee Repository to handle all the database interaction. My problem is that my code performs instruction but then throws




System.InvalidOperationException: 'Sequence contains no elements'.




I have tried using FirstOrDefault and SingelOrDefault as suggested but previous posts I've read but it performs the remove operation and throws




System.NullReferenceException: 'Object reference not set to an
instance of an object.'




removeEmployee was null. Can someone help explain to me how to fix it



This is the code I am trying to refactor and this initial code worked without throwing an exception:



[HttpPost]
public IActionResult Remove(int employeeIds)
{

foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employee.Remove(removeEmployee);
}
else
{
return Redirect("/Employee/Remove");
}

}
context.SaveChanges();
return Redirect("/");
}


Below is how I am trying to refactor my code.



Employee Repoistory:



 public bool RemoveEmployee(int employeeIds)
{
foreach (int employeeId in employeeIds)
{
Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

if (removeEmployee.WorkStatus == "Available")
{
context.Employees.Remove(removeEmployee);
}
else
{
return false;
}
}
context.SaveChanges();
return true;
}


Employee Controller:



private IEmployeesRepository repo;

public EmployeeController(IEmployeesRepository repo)
{
this.repo = repo;
}

[HttpPost]
public IActionResult Remove(int employeeIds)
{
repo.RemoveEmployee(employeeIds);

if (repo.RemoveEmployee(employeeIds) == false)
{
return Redirect("/Employee/Remove");
}
else
{
return Redirect("/");
}
}






c# asp.net-core entity-framework-6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 4:01







iyke

















asked Nov 24 '18 at 1:35









iykeiyke

216




216








  • 1





    here's your problem right here: Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

    – JohnB
    Nov 24 '18 at 1:38






  • 1





    See the docs, it returns InvalidOperationException when the predicated function yields 0 results and NullReferenceException if any of the items being evaluated are null. I am still reading the title part over to try to understand what you mean by "but still performs instructions".

    – Ross Bush
    Nov 24 '18 at 1:43













  • About the only way it could "still work" would be if you did the worst thing and swallowed the exceptions. Here are two articles on proper exception handling that I link quite often: blogs.msdn.microsoft.com/ericlippert/2008/09/10/… | codeproject.com/Articles/9538/…

    – Christopher
    Nov 24 '18 at 2:06











  • @RossBush the code does what I want it to do except that it throws the exception and crashes. it wouldn't remove/delete object from table if it null. my code worked perfectly well before I tried to refactor it. I just don't understand what I am doing wrong this time

    – iyke
    Nov 24 '18 at 2:28











  • @Christopher I understand exception handling could fix my problem. I just don't understand why the initial code works just fine without exception handling but the little change I made is breaking my code. Understanding what I am doing wrong is actually more important to me

    – iyke
    Nov 24 '18 at 2:33














  • 1





    here's your problem right here: Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

    – JohnB
    Nov 24 '18 at 1:38






  • 1





    See the docs, it returns InvalidOperationException when the predicated function yields 0 results and NullReferenceException if any of the items being evaluated are null. I am still reading the title part over to try to understand what you mean by "but still performs instructions".

    – Ross Bush
    Nov 24 '18 at 1:43













  • About the only way it could "still work" would be if you did the worst thing and swallowed the exceptions. Here are two articles on proper exception handling that I link quite often: blogs.msdn.microsoft.com/ericlippert/2008/09/10/… | codeproject.com/Articles/9538/…

    – Christopher
    Nov 24 '18 at 2:06











  • @RossBush the code does what I want it to do except that it throws the exception and crashes. it wouldn't remove/delete object from table if it null. my code worked perfectly well before I tried to refactor it. I just don't understand what I am doing wrong this time

    – iyke
    Nov 24 '18 at 2:28











  • @Christopher I understand exception handling could fix my problem. I just don't understand why the initial code works just fine without exception handling but the little change I made is breaking my code. Understanding what I am doing wrong is actually more important to me

    – iyke
    Nov 24 '18 at 2:33








1




1





here's your problem right here: Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

– JohnB
Nov 24 '18 at 1:38





here's your problem right here: Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);

– JohnB
Nov 24 '18 at 1:38




1




1





See the docs, it returns InvalidOperationException when the predicated function yields 0 results and NullReferenceException if any of the items being evaluated are null. I am still reading the title part over to try to understand what you mean by "but still performs instructions".

– Ross Bush
Nov 24 '18 at 1:43







See the docs, it returns InvalidOperationException when the predicated function yields 0 results and NullReferenceException if any of the items being evaluated are null. I am still reading the title part over to try to understand what you mean by "but still performs instructions".

– Ross Bush
Nov 24 '18 at 1:43















About the only way it could "still work" would be if you did the worst thing and swallowed the exceptions. Here are two articles on proper exception handling that I link quite often: blogs.msdn.microsoft.com/ericlippert/2008/09/10/… | codeproject.com/Articles/9538/…

– Christopher
Nov 24 '18 at 2:06





About the only way it could "still work" would be if you did the worst thing and swallowed the exceptions. Here are two articles on proper exception handling that I link quite often: blogs.msdn.microsoft.com/ericlippert/2008/09/10/… | codeproject.com/Articles/9538/…

– Christopher
Nov 24 '18 at 2:06













@RossBush the code does what I want it to do except that it throws the exception and crashes. it wouldn't remove/delete object from table if it null. my code worked perfectly well before I tried to refactor it. I just don't understand what I am doing wrong this time

– iyke
Nov 24 '18 at 2:28





@RossBush the code does what I want it to do except that it throws the exception and crashes. it wouldn't remove/delete object from table if it null. my code worked perfectly well before I tried to refactor it. I just don't understand what I am doing wrong this time

– iyke
Nov 24 '18 at 2:28













@Christopher I understand exception handling could fix my problem. I just don't understand why the initial code works just fine without exception handling but the little change I made is breaking my code. Understanding what I am doing wrong is actually more important to me

– iyke
Nov 24 '18 at 2:33





@Christopher I understand exception handling could fix my problem. I just don't understand why the initial code works just fine without exception handling but the little change I made is breaking my code. Understanding what I am doing wrong is actually more important to me

– iyke
Nov 24 '18 at 2:33












2 Answers
2






active

oldest

votes


















0














As Ross Bush pointed out, the line of code mentioned by JohnB throws invalid operation exception if the predicate (c => c.EmployeeID == employeeId) yields 0 results when your method is just 'Single'. If you put 'SingleOrDefault' the result will be null. So "removeEmployee" will be null. When you access any member under removeEmployee which is now null (like "removeEmployee.WorkStatus"), it will throw the null reference exception.



I am not sure how your code worked before. Your first version of code has context.Employee, but your modified version has context.Employees. I suspect there is something going on there or it might be that when you tested with the original code, there might have been some data






share|improve this answer































    0














    Thanks to everybody that bothered to look at my problem and tried to help me find a solution. The problem with my code actually had to do with the logic in my "RemoveEmployee" Method and the return Boolean value. Below is the solution I came up with.



    Employee Repository:



    public bool RemoveEmployee(int employeeIds)
    {
    foreach (int employeeId in employeeIds)
    {
    Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);
    if (removeEmployee !=null && removeEmployee.WorkStatus == "Available")
    {
    context.Employees.Remove(removeEmployee);
    context.SaveChanges();
    return true;
    }
    }
    return false;
    }


    Employeee Controller:



    [HttpPost]
    public IActionResult Remove(int employeeIds)
    {
    if (repo.RemoveEmployee(employeeIds) == false)
    {
    return Redirect("/Employee/Remove");
    }
    else
    {
    return Redirect("/Employee");
    }
    }





    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454446%2fexception-handling-while-deleting-object-in-asp-net-core%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      As Ross Bush pointed out, the line of code mentioned by JohnB throws invalid operation exception if the predicate (c => c.EmployeeID == employeeId) yields 0 results when your method is just 'Single'. If you put 'SingleOrDefault' the result will be null. So "removeEmployee" will be null. When you access any member under removeEmployee which is now null (like "removeEmployee.WorkStatus"), it will throw the null reference exception.



      I am not sure how your code worked before. Your first version of code has context.Employee, but your modified version has context.Employees. I suspect there is something going on there or it might be that when you tested with the original code, there might have been some data






      share|improve this answer




























        0














        As Ross Bush pointed out, the line of code mentioned by JohnB throws invalid operation exception if the predicate (c => c.EmployeeID == employeeId) yields 0 results when your method is just 'Single'. If you put 'SingleOrDefault' the result will be null. So "removeEmployee" will be null. When you access any member under removeEmployee which is now null (like "removeEmployee.WorkStatus"), it will throw the null reference exception.



        I am not sure how your code worked before. Your first version of code has context.Employee, but your modified version has context.Employees. I suspect there is something going on there or it might be that when you tested with the original code, there might have been some data






        share|improve this answer


























          0












          0








          0







          As Ross Bush pointed out, the line of code mentioned by JohnB throws invalid operation exception if the predicate (c => c.EmployeeID == employeeId) yields 0 results when your method is just 'Single'. If you put 'SingleOrDefault' the result will be null. So "removeEmployee" will be null. When you access any member under removeEmployee which is now null (like "removeEmployee.WorkStatus"), it will throw the null reference exception.



          I am not sure how your code worked before. Your first version of code has context.Employee, but your modified version has context.Employees. I suspect there is something going on there or it might be that when you tested with the original code, there might have been some data






          share|improve this answer













          As Ross Bush pointed out, the line of code mentioned by JohnB throws invalid operation exception if the predicate (c => c.EmployeeID == employeeId) yields 0 results when your method is just 'Single'. If you put 'SingleOrDefault' the result will be null. So "removeEmployee" will be null. When you access any member under removeEmployee which is now null (like "removeEmployee.WorkStatus"), it will throw the null reference exception.



          I am not sure how your code worked before. Your first version of code has context.Employee, but your modified version has context.Employees. I suspect there is something going on there or it might be that when you tested with the original code, there might have been some data







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 24 '18 at 3:58









          SunilSunil

          32




          32

























              0














              Thanks to everybody that bothered to look at my problem and tried to help me find a solution. The problem with my code actually had to do with the logic in my "RemoveEmployee" Method and the return Boolean value. Below is the solution I came up with.



              Employee Repository:



              public bool RemoveEmployee(int employeeIds)
              {
              foreach (int employeeId in employeeIds)
              {
              Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);
              if (removeEmployee !=null && removeEmployee.WorkStatus == "Available")
              {
              context.Employees.Remove(removeEmployee);
              context.SaveChanges();
              return true;
              }
              }
              return false;
              }


              Employeee Controller:



              [HttpPost]
              public IActionResult Remove(int employeeIds)
              {
              if (repo.RemoveEmployee(employeeIds) == false)
              {
              return Redirect("/Employee/Remove");
              }
              else
              {
              return Redirect("/Employee");
              }
              }





              share|improve this answer




























                0














                Thanks to everybody that bothered to look at my problem and tried to help me find a solution. The problem with my code actually had to do with the logic in my "RemoveEmployee" Method and the return Boolean value. Below is the solution I came up with.



                Employee Repository:



                public bool RemoveEmployee(int employeeIds)
                {
                foreach (int employeeId in employeeIds)
                {
                Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);
                if (removeEmployee !=null && removeEmployee.WorkStatus == "Available")
                {
                context.Employees.Remove(removeEmployee);
                context.SaveChanges();
                return true;
                }
                }
                return false;
                }


                Employeee Controller:



                [HttpPost]
                public IActionResult Remove(int employeeIds)
                {
                if (repo.RemoveEmployee(employeeIds) == false)
                {
                return Redirect("/Employee/Remove");
                }
                else
                {
                return Redirect("/Employee");
                }
                }





                share|improve this answer


























                  0












                  0








                  0







                  Thanks to everybody that bothered to look at my problem and tried to help me find a solution. The problem with my code actually had to do with the logic in my "RemoveEmployee" Method and the return Boolean value. Below is the solution I came up with.



                  Employee Repository:



                  public bool RemoveEmployee(int employeeIds)
                  {
                  foreach (int employeeId in employeeIds)
                  {
                  Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);
                  if (removeEmployee !=null && removeEmployee.WorkStatus == "Available")
                  {
                  context.Employees.Remove(removeEmployee);
                  context.SaveChanges();
                  return true;
                  }
                  }
                  return false;
                  }


                  Employeee Controller:



                  [HttpPost]
                  public IActionResult Remove(int employeeIds)
                  {
                  if (repo.RemoveEmployee(employeeIds) == false)
                  {
                  return Redirect("/Employee/Remove");
                  }
                  else
                  {
                  return Redirect("/Employee");
                  }
                  }





                  share|improve this answer













                  Thanks to everybody that bothered to look at my problem and tried to help me find a solution. The problem with my code actually had to do with the logic in my "RemoveEmployee" Method and the return Boolean value. Below is the solution I came up with.



                  Employee Repository:



                  public bool RemoveEmployee(int employeeIds)
                  {
                  foreach (int employeeId in employeeIds)
                  {
                  Employee removeEmployee = context.Employees.Single(c => c.EmployeeID == employeeId);
                  if (removeEmployee !=null && removeEmployee.WorkStatus == "Available")
                  {
                  context.Employees.Remove(removeEmployee);
                  context.SaveChanges();
                  return true;
                  }
                  }
                  return false;
                  }


                  Employeee Controller:



                  [HttpPost]
                  public IActionResult Remove(int employeeIds)
                  {
                  if (repo.RemoveEmployee(employeeIds) == false)
                  {
                  return Redirect("/Employee/Remove");
                  }
                  else
                  {
                  return Redirect("/Employee");
                  }
                  }






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 25 '18 at 23:56









                  iykeiyke

                  216




                  216






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454446%2fexception-handling-while-deleting-object-in-asp-net-core%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Costa Masnaga

                      Fotorealismo

                      Sidney Franklin