locked
Entity Framework Validation Vs Asp.net Valdiations RRS feed

  • Question

  • Hi, In our product we are using entity framework validation. But these valdiations are performing from server side. I just want to make sure which one is better, asp.net server side validations or Entity framework validations

    Could some one please help me regarding this

     

    Thanks in advance

    Thanks

    Prathyusha


    Thanks Prathyusha
    • Moved by Dummy yoyo Tuesday, October 11, 2011 3:22 AM (From:Visual C# General)
    Monday, October 10, 2011 1:56 PM

Answers

  • When you mentioned asp.net serverside validation is UI validations?  

    I would suggest your model should be protected in all to restrict persisting un-stabalized data.....what if the future requirement comes to create REST full services on top of model? 

    so, define validations on EntityFramework level and create a mechanism generating serverside validations from these. (I guess MVC3 with code-first approach is working on same principle, http://msdn.microsoft.com/en-us/data/gg193959)

    Hope this helps you....


    If this post answers your question, please click "Mark As Answer". If this post is helpful please click "Mark as Helpful".
    • Proposed as answer by Alan_chen Tuesday, October 11, 2011 8:41 AM
    • Marked as answer by Alan_chen Tuesday, October 18, 2011 3:25 AM
    Tuesday, October 11, 2011 8:01 AM

All replies

  • On 10/10/2011 9:56 AM, usha23 wrote:
    > Hi, In our product we are using entity framework validation. But these
    > valdiations are performing from server side. I just want to make sure
    > which one is better, asp.net server side validations or Entity framework
    > validations
    >
    > Could some one please help me regarding this
    >
     
    You should make the UI as dumb as possible when it comes to validations
    as that is business logic. At best, you should do Required Field
    controls validation on the client-side.
     
    If validation is being done at the EF model level, then it's too late in
    the process.
     
    The validations should done by business logic well before the attempt is
    made to save the data.
     
    Monday, October 10, 2011 2:15 PM
  • Hi Prathyusha,
    Welcome to the MSDN forum!

    Regarding the problem, I have move the thread from C# General forum to the current forum for better support. 

    Thank you for your understanding and have a nice day!
    Yoyo. 

     


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, October 11, 2011 3:23 AM
  • When you mentioned asp.net serverside validation is UI validations?  

    I would suggest your model should be protected in all to restrict persisting un-stabalized data.....what if the future requirement comes to create REST full services on top of model? 

    so, define validations on EntityFramework level and create a mechanism generating serverside validations from these. (I guess MVC3 with code-first approach is working on same principle, http://msdn.microsoft.com/en-us/data/gg193959)

    Hope this helps you....


    If this post answers your question, please click "Mark As Answer". If this post is helpful please click "Mark as Helpful".
    • Proposed as answer by Alan_chen Tuesday, October 11, 2011 8:41 AM
    • Marked as answer by Alan_chen Tuesday, October 18, 2011 3:25 AM
    Tuesday, October 11, 2011 8:01 AM