Can you explain what you mean when you say lazy loading will not work
with the code above?



On Jun 17, 12:27 am, Markus Zywitza <[email protected]> wrote:
> Sure, you can. But it will backfire. First, you won't be able to load
> anything lazily which might result in loading the whole DB with a simple
> Entity.FindAll().
> Second, the scope of transactions is dictated by the business logic. You
> can't even model a simple debit-credit-exampe with this approach.
>
> -Markus
>
> 2009/6/17 csharp <[email protected]>
>
>
>
>
>
> > Actually, 1 last question.
>
> > I dont expose persistence concerns to anything outside my objects.
> > internally can I get this to work with something like this:
>
> >        public override void Save()
> >        {
> >            using (TransactionScope trans = new TransactionScope())
> >            {
> >                try
> >                {
> >                    base.Save();
> >                    trans.VoteCommit();
> >                }
> >                catch
> >                {
> >                    trans.VoteRollBack();
> >                    throw;
> >                 }
> >            }
> >        }
>
> > On Jun 16, 4:38 am, Markus Zywitza <[email protected]> wrote:
> > > No, if you want the the cascade to be performed in a transaction you need
> > to
> > > put a scope around the code that calls Save().
>
> > > -Markus
> > > 2009/6/16 csharp <[email protected]>
>
> > > > Thanks Markus.
>
> > > > I am using it as a named parameter on an attribute, such as :
>
> > > >        [BelongsTo(
> > > >            Column = "ColumnName",
> > > >            Type = typeof(TypeName),
> > > >            Fetch = FetchEnum.Join,
> > > >            Cascade = CascadeEnum.SaveUpdate,
> > > >            NotNull = true)]
>
> > > > Doing it this way, I thought, alleviated the need for me to use a
> > > > session scope or transaction scope.  If the cascade is performed
> > > > automatically since it is declared in the attribute, my question is
> > > > does it get performed inside a transaction or not?
>
> > > > Or are you saying i must override Save to put the Save method inside a
> > > > transaction to be sure?
>
> > > > Thanks.
>
> > > > On Jun 15, 9:31 am, Markus Zywitza <[email protected]> wrote:
> > > > > It uses the current session's transaction context: If you use
> > > > SessionScope
> > > > > or TransactionScope around your code, it is called within the
> > > > transactions
> > > > > provided by these scopes. If you call AR naked, there is no
> > transaction
> > > > > around the call.
>
> > > > > -Markus
>
> > > > > 2009/6/14 csharp <[email protected]>
>
> > > > > > If I specify a Cascade, such as CascadeEnum.SaveUpdate, is the
> > save/
> > > > > > update performed inside a transaction?  If not, is there a way to
> > > > > > specify that it should be?
>
> > > > > > Thanks.
> > > > > > Jason- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to