This is a migrated thread and some comments may be shown as answers.

Openaccess & Custom Business Rules

3 Answers 92 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kieren
Top achievements
Rank 1
Kieren asked on 03 Jan 2012, 08:37 PM
Hi,

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.

Thanks,

Kieren

3 Answers, 1 is accepted

Sort by
0
Ivailo
Telerik team
answered on 05 Jan 2012, 01:27 PM
Hi Kieren,

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

I suggest we continue the conversation there.

Regards,
Ivailo
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!

0
Ian
Top achievements
Rank 1
answered on 21 Mar 2012, 02:01 AM
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?

Thanks
0
Ivailo
Telerik team
answered on 22 Mar 2012, 10:45 AM
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,
Ivailo
the Telerik team
Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Tags
Getting Started
Asked by
Kieren
Top achievements
Rank 1
Answers by
Ivailo
Telerik team
Ian
Top achievements
Rank 1
Share this question
or