none
Is it a good practice to return affected rows count from CRUD operations? RRS feed

  • Question

  • I have many methods like Add, Remove, Update using LINQ to SQL with Repository pattern. Now all these methods return void. Is it a good practice to return affected rows count from CRUD operations?
    Tuesday, July 3, 2012 12:50 PM

Answers

  • Both are good practices and you may use both ways for logging purpose and / or presentation layers usage. But which way to choose is, as I said, totally your choice and depend on the application requirement.

    Cheer!

    • Marked as answer by EngineerSpock Wednesday, July 4, 2012 8:31 AM
    Wednesday, July 4, 2012 7:01 AM

All replies

  • I think that will totally depend on an application's needs and requirements.

    If its not for presentation layer, you may use that information for logging together with the query executed, for audit purpose?

     
    Tuesday, July 3, 2012 1:33 PM
  • But how does the client know that operation is successfully executed? Is it convenient just to rely on a structured exception handling?

    Wednesday, July 4, 2012 6:55 AM
  • Both are good practices and you may use both ways for logging purpose and / or presentation layers usage. But which way to choose is, as I said, totally your choice and depend on the application requirement.

    Cheer!

    • Marked as answer by EngineerSpock Wednesday, July 4, 2012 8:31 AM
    Wednesday, July 4, 2012 7:01 AM