Here are some random thoughts...

'transaction' here is like a State monad, in that it's about state in the ambient environment. If you are not familiar with a State monad, you might read it and check out

[link:cs.hubfs.net]

Then I think you can model your code as

1
2
3
4
5
6
7
8
9
10
11
12
 

transaction {

    let p = new PersonDao()

    do! deleteAddressByPersonId(p, personid)

    do! deletePerson(p, personid)

}

where the monadic operations grab the 'current transaction' out of the state monad. You might also consider authoring something along the lines of

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 

let (|!>) mx mf =
    m {
        let! x = mx
        let! r = mf x
        return r
    }
    
m {
    let! x = Blah()
    let! y = f(x)
    let! z = g(y)
    return z
}

Blah() |!> f |!> g

for pipeline-composition syntax in the monad 'm'. I haven't thought all the way through that, but hopefully those are some starter ideas.

By on 5/22/2009 5:53 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper