Page view counter

How do I Handle Business Logic Exceptions?

This video shows you how to add validation to the data model. You will be able to see how that validation logic is reflected in the UI.

Presented by Scott Hanselman

Duration: 5 minutes, 32 seconds

Date: 8 May 2008

Watch the video   |   Download the video

Video downloads: WMV | Zune | iPod | PSP | MPEG-4 | 3GP

Audio downloads: AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Comments : 9

Leave a Comment

CODEWIRE.NET : On May 31, 2008 4:59 PM said:

How du I access Session in the partiel method like  OnValidate? I want to set a field to a session-variable on every insert.

if (action == System.Data.Linq.ChangeAction.Insert)

{

  Id = Guid.NewGuid();

  AccountId = Session("AccontId"); // Current account

}

shanselman : On June 09, 2008 2:25 PM said:

You would need to use HttpContext.Current.Session, but I think you'd be tying your model objects to the Session which could limit your design's usefulness in other projects.

shanselman : On June 09, 2008 2:25 PM said:

You'd need to use HttpContext.Current.Session.

Dom Márcio : On July 07, 2008 10:39 PM said:

Hi Scott. How can I implement business logic in the Delete-Insert-Update/Object partial method in the DataContext partial class? Thanks in advance.

EdSF : On August 25, 2008 7:52 PM said:

Thanks for all your work on these videos!

jtwebman : On September 29, 2008 6:40 PM said:

Scott first off thank you very much for the videos! I am starting to understand the power of Dynamic data.

One question that throws red alerts in my mind is using exceptions for validation. Is there way to tie in a more simple validation like in Rocky Lhotka CSLA framework of having a collection of validation errors instead of throwing a expensive (time and cpu) exception?

Thanks!

dev01 : On October 15, 2008 4:45 PM said:

I created a partial class Product and implemented OnProductNameChanging just like Scott in the video. It fires 3 times with new value, old value and then again new value of the product? Therefore throwing ValidationException the second  time it fires with the value Chai instaed of ACME.

mgrassman : On October 17, 2008 3:01 AM said:

I got the same as above any solution/how to check which value we are using.

Thanks for the great tutorials.

djibril_chimere_DIAW : On October 31, 2008 11:58 AM said:

Thanks! Jërëjëf!

Leave a Comment

You must be logged in to leave a comment. Click here to log in.

Microsoft Communities