Data access objects don't run business rules

For example, if I use


Orders myorder = new Orders();
/* fill in all properties of myorder */
myorder.Insert();


the following business rule doesn't get executed


[ControllerAction("Orders", "Insert", ActionPhase.Before)]
public void Insert_Orders()


If I add the following at the top of the method ActionResult IDataController.Execute(string controller, string view, ActionArgs args) in Controller.Core.cs then it works


if (String.IsNullOrEmpty(args.Controller)) args.Controller = controller;
5 people have
this problem
+1
Reply
  • Yea, our team is having the same issue... Here's an example

    [ControllerAction("TicketHeader","Insert",ActionPhase.Before)]
    public void CalculateTicketHeader(int? caseID, string title, int? contactID, string contactCompanyName, string contactStatename, int? caseStatusID, string caseStatusTitle, string ticketNumber, DateTime? dueDate, int? priorityID, string priorityTitle, int? severityID, string severityTitle, int? assignedToEmployee, string assignedToEmployeeFristName)
    {
    Random random = new Random();
    int randomNumber = random.Next(0, 100000);

    if (string.IsNullOrEmpty(ticketNumber))
    {
    ticketNumber = "T" + Convert.ToString(randomNumber);
    UpdateFieldValue("TicketNumber", ticketNumber);
    }
    }

    this is in Shared biz rules, this never worked. UpdateFieldValue does not seem to set the value. However when tested within a Action, all works as it should. Work around was to use a third party control. Although, looking at Bron's solution may be a better alternative. That way we can utilize the framework.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated