Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 224051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:16:49+00:00 2026-05-11T19:16:49+00:00

I am designing a project where all the main components share a single common

  • 0

I am designing a project where all the main components share a single common DomainObject (yeah I stole the term from O/RM world, but its not quite an O/RM project.) The DomainObject maintains the objects change state (dirty/clean) and allows itself to be rolled back or committed (AcceptChanges(), RejectChanges() ). When AcceptChanges() is called on an object, it fires an event and that event would trigger the writing of hte values to the underlying datastore. Also, it passes a parameter allowing the persistance to be cancelled in the event.

1) Classroom (a DomainObject) is instantiated and its properties modified.
2) Classroom.AcceptChanges() is called, triggering the OnAcceptEvent and passing the DomainObjectChangeEventArgs, which contain a boolean property called Cancel
3) If Not Cancelled by the event, changes are accepted and the state of hte Classroom is updated.
4) The project then calls AcceptChanges on any internal properties that are also DomainObjects, such as Student.
5) Each Student triggers the OnAcceptEvent passing a DomainObjectChangeEventArgs…etc.

Now, asking the community at large:

A) Would you have the cancel indicator on the Classroom’s AcceptEvent stop the entire process forcing it to no longer evaluate and possibly Accept any Students, or would you code the Cancel to just apply to the classroom.
b) Would the Cancel indicator on any Student be expected to stop the processing on any additional Students?

My initial thought is that the cancel indicator on the Classroom’s event should stop the entire process, therefore allowing a graceful preservation of the pre-accepted state of the classroom and all the students without involving the overhead of a transaction. But I am not necessarilly convinced that I am correct.

What would you do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:16:49+00:00Added an answer on May 11, 2026 at 7:16 pm

    I’d call the event CanSave, which returns an enum { OK, Cancel }. Prior to persisting anything I’d query the whole object graph, looking for a cancel. Each object can validate itself and cancel if it’s not currently in a persistable state… averting most, but by no means all, rollbacks.

    But what can you do with a Cancel? One of the prime edicts of good software is “Allways allow the user to save there work”. Programmers wouldn’t abide an IDE which won’t save uncompilable source-code, so why would you expect your users to put-up with it?

    Cancel states should be truly exceptional states… like can’t write to readonly file –> “Save As” instead? Or a null key-field –> “username is required”.

    So what’s the alternative? Save to an intermediate format, one which can store “invalid” data… like a text file.

    Aside: I’ve often thought that database-apps are missing a “validate” button, allowing the user to find out “is this OK?” without actually committing to it.

    Just food for thought.

    Cheers. Keith.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 162k
  • Answers 162k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer So here is a commmand line example of how to… May 12, 2026 at 12:01 pm
  • Editorial Team
    Editorial Team added an answer You already assigned the first row to $row_rs_jobboards11, so when… May 12, 2026 at 12:01 pm
  • Editorial Team
    Editorial Team added an answer This can occur any time an exception is thrown inside… May 12, 2026 at 12:01 pm

Related Questions

I am in a process of designing a custom SharePoint application. On a previous
I am currently designing a Membership/Profile scheme for a new project I am working
I'm trying to get my head around Domain Driven Design and the examples I've
I am relatively new to game development so I decided I wanted to create

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.