Openaccess & Custom Business Rules

Thread is closed for posting
4 posts, 0 answers
  1. Kieren
    Kieren avatar
    2 posts
    Member since:
    Aug 2011

    Posted 03 Jan 2012 Link to this post


    I am building an ASP.NET web application with RadControls and Openaccess ORM.  I have three projects in my site, 

    1.  Website
    2. Business Layer
    3. Data Access Layer - which holds the Openaccess RLinq file and the generated classes.

    What I cannot seem to figure out is how to calculate values and insert into the ORM (Database).  For example,

    If I have an Entity which represents a piece of food, it will have an ExpiryDate based on its ProductType and ManufactureDate.

    I realize that the ORM generates partial classes, but because ExpiryDate is a property in the generated class, I cannot access it an insert my custom code.

    I can use a custom class and 'Translate' it into the FoodEntity class before persisting it, and have my code there.  But, if I do this, then the RedGrid auto-update (edit) capabilities are lost because my code will not be accessed in the custom object.

    I have looked at the BestPractices webproject, and researched a fair amount on the site, and it seems like creating the Food Object, then translating it into the FoodEntity object prior to context.SaveChanges is probably the best way to go about this.

    If anyone has or knows of techniques / samples for doing this (implementing custom code) that would be fantastic.


  2. Ivailo
    Ivailo avatar
    318 posts

    Posted 05 Jan 2012 Link to this post

    Hi Kieren,

    Please find our answer in your other thread - Custom business rules for object properties. 

    I suggest we continue the conversation there.

    the Telerik team

    Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  3. Ian
    Ian avatar
    26 posts
    Member since:
    Jun 2012

    Posted 20 Mar 2012 Link to this post

    I'm browsing the forums looking for interesting tidbits of information.
    I've tried and failed to find the other thread to which you've referred.  Could you please provide a link or a search term that would find it?

  4. Ivailo
    Ivailo avatar
    318 posts

    Posted 22 Mar 2012 Link to this post

    Hello Vernon,

    In this case the thread was duplicated in the support system and in the forums.

    I will additionally summarize the support communication for further reference here so that more people can have access to the answer:

    Our general recommendation for cases with complex relationships between persistent and non-persistent fields is to handle the data binding manually without using the Auto Update capabilities of the grid. You can use the Add/Update/Delete events of the grid to plug you code in for that purpose. 

    Kind regards,
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Back to Top