Validate objects RRS feed

  • Question

  • hello,

    In my code I have 3 object that I need to insert to the database.

    I want to validate those objects before inserting them so that if the second is not valid the first one doesn't make it to the database.

    I hope the question is clear.


    Monday, April 26, 2010 2:03 PM


All replies

  • You need to implement the OnValidate partial method for the entities you wish to validate.
    Some details are available here. And one more blog post concerning entity validation.
    Devart Team
    ADO.NET data providers for Oracle, MySQL, PostgreSQL, SQLite with Entity Framework and LINQ to SQL support
    Tuesday, April 27, 2010 9:43 AM
  • Thanks for the response but this doesn't realy solve my answer.

    I basicly want the following:

    DAL.Event nieuwEvent = new DAL.Event();
    nieuwEvent.Begindatum = DateTime.Parse(begindatum.
    nieuwEvent.Einddatum = DateTime.Parse(einddatum.Text);
    -->!!!! Here I want to validate the object nieuwEvent, so validate before insertonsubmit


    Monday, May 3, 2010 4:37 PM