Re: AR - issue with removing an item from a HasMany relation

2009-01-13 Thread Markus Zywitza

In one application, I associate user accounts with computers based on
usage of the computer. I have to both access the computers from the
accounts and vice versa in many places in my code. Therefore I took
the way to make it bidirectional using Add/Remove-Methods to assure
that the association is really valid from both sides.
In the same application, I have installation data mapped to computers.
It turns out that the computers are almost never asked for the
installations (there are separate software-computer and
software-installation associations) so this is a unidirectional
association from installation to computer. Because it is a many-to-one
association, I could omit any special code and simply left it as a
public property.

-Markus

2009/1/12 Mark Jensen don...@gmail.com:

 haha, yeah :P

 but do you have an example when this could be relevant :)

 On Jan 12, 3:59 pm, Markus Zywitza markus.zywi...@gmail.com wrote:
  So when would you consider to use bidirectional association ?

 When you need to access the objects via both directions.

 -Markus
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Service override keys

2009-01-13 Thread Felix Gartsman

Hi,
Could someone clarify what I'm doing wrong here? As an example
consider 2 dummy classes:
internal class MyClass
{
private readonly int myParam;
public MyClass(int myParam)
{
this.myParam = myParam;
}
public int MyParam
{ get { return this.myParam; } }
}

internal class MyClass2
{
private readonly MyClass myParam2;
public MyClass2(MyClass myParam2)
{
this.myParam2 = myParam2;
}
public MyClass MyParam2
{ get { return this.myParam2; } }
}

I register them via XML:
component
id=MyClassA type=CastleScratch.MyClass, CastleScratch
lifestyle=transient
  parameters
MyParam5/MyParam
  /parameters
/component

component
id=MyClassB type=CastleScratch.MyClass2, CastleScratch
lifestyle=transient
  parameters
MyParam2${MyClassA}/MyParam2
  /parameters
/component

Now I resolve:
MyClass2 t = IoC.ResolveMyClass2(MyClassB, new { myParam2 = new
MyClass(7)});

But t.MyParam2.MyParam==5. Why the override fails, or what I'm
missing?

Felix.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: Is Castle project still alived and stable?

2009-01-13 Thread andypike

I use the full Castle stack at work and for personal projects. I can't
name clients, but some of the largest brands in the world are using
Castle to power their web applications (I know that because I worked
on them). I've been using the Castle Project for a number of years and
along with NHibernate it is right at the top of the .NET OSS world.

See http://andypike.wordpress.com for some of my articles related to
Castle

Cheers


On Jan 12, 6:13 am, floyd floyd...@gmail.com wrote:
 Hi all,
 The official release is RC-3 on 2007. I would like to knpw is Castle
 Project still alived or it's just in very slow ahead to final release?

 Does anyone use castle projetc including MonoRail/ActiveRecord things
 in production environment?

 looking forward reply.

 Thanks in advance.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: Is Castle project still alived and stable?

2009-01-13 Thread Tuna Toksöz
It is like after May, IIRC

Tuna Toksöz
http://tunatoksoz.com

Typos included to enhance the readers attention!



On Tue, Jan 13, 2009 at 7:05 PM, James, Justin justin.ja...@intel.comwrote:


 Do you happen to know what the timeline is for NH 2.1 GA?

 Justin

 -Original Message-
 From: castle-project-users@googlegroups.com [mailto:
 castle-project-us...@googlegroups.com] On Behalf Of Markus Zywitza
 Sent: Tuesday, January 13, 2009 4:46 AM
 To: castle-project-users@googlegroups.com
 Subject: Re: Is Castle project still alived and stable?


 2009/1/12 Floyd Wu floyd...@gmail.com:
  Thanks a lot. I like Castle but for some reason I just wanna know when
 will
  be next release. :)

 ActiveRecord 1.0 Final will be released when NH 2.1GA is available.

 -Markus



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: Refresh with transient objects (nHibernate + ActiveRecord)

2009-01-13 Thread Darius Damalakas
That's a very interesting problem you are addressing.

I will tell what we did in ou desktop app. Maybe this will give you an
overview of how different people use Castle.ActiveRecord and NHibernate to
achieve their goals. I don't say the below approach is brilliant or even
satisfactory, but it does reach it indeded purpose. So yes, business value
is delivered :)

Our app is performing all operations in memory + we use (already deprecated)
NHIbernate.Generics library so that both ends of association would contain
correct data.

Say we have this use case:

1) User want to create new parent object. A parent form is opened.
2) parent editing form has also a tab, where we display a list of all childs
it has
3) user wants to add new child, so he opens child editing form
4) user presses save on child editing form. form closes
5) parent form now shows one child in tab
6) user click on cancel button in parent form, and cancels all changes


What is happening under the hood in our app is:
1) we have a list of where we store all still to be applied operations on
the database.
So to this list we add single operation - save to databse our newly created
parent, but yet not commit this.
3) a new child object is created in memory (just plain object)
4) a relationship is made from childto parent.  for ex.  child.Parent =
myParent.   Now parent.ChildCollection contains one item, which is not yet
saved to databse.   This is happening with the help of NHibernate.Generics
All database operations from child editing form are appended to database
operations from parent editing form. Now there are two operations - both are
save to database. Firs operation saves parent, second - child.
6) when cancel is pressed, operations on databse are not applied. All
relationship changes made in memory are rolled backed. In this case,
child.Parent is set again to null.

This rollbacking makes possible to construct any-level of undo mechanism.
With this approach it is possible to work for one hour with an object and
then cancel any level of changes you made to the system.






2009/1/13 Greg Burri greg.bu...@gmail.com


 Hi,
 I use nHibernate with ActiveRecord in a such manner :
* I have a global session of type 'TransactionScope'
* When the user want to save his work his click on file - save
 of the application menu. This action will execute a such code :
 globalSession.VoteCommit();
 globalSession.Dispose();
 globalSession = new TransactionScope();


 Basically I have a dialog to edit an object 'p' of class 'Parent'
 which owns some objects 'c' of class 'Child'. Both of theses classes
 deriving from 'ActiveRecordLinqBase'.

 When the user choose 'Cancel' from the dialog after editing some
 values of 'a' and adding or removing some B objects I want to reverse
 theses changes (that is remove 'Child' objects that was added and add
 removed 'Child' objects).

 (Case 1) If I use the method p.Refresh() there will be an exception
 like No row with the given identifier exists[Child#0] in the case
 the user added some 'c'.
 (Case 2) If I use a transaction with p.SaveAndFlush() +
 t.VoteRollBack() + t.Dispose() then this error will be throwed :
 Illegal attempt to associate a collection with two open
 sessions (for the same case above, where a 'b' is added).

 Is my approach is good ? Or it's a misusing of nHibernate and
 ActiveRecord ?

 I have uploaded a little sample project here :
 http://www.gburri.org/bordel/ActiveRecordLifecycle.zip. If you want to
 run it you need PostgreSQL or change the 'app.config'.
 This sample will create a parent and some children attached to it at
 launch.
 You can edit the 'Parent' object and change its state with the button
 Change state and try to undo the modifications with Cancel.

 Here are some additional information about my configuration :

 nHibernate version: 2.1.0.1001
 Active record version: 1.0.3.0
 Database: PostgreSQL 8.3

 Thanks in advance.

 /Greg

 



-- 
Darius Damalakas

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: Is Castle project still alived and stable?

2009-01-13 Thread Rob

Yes, some of us have the requirement to use only released software in
our live applications. Sure, development can use code we build locally
out of a repository, but that's not accepted when we release to QA and
Production.

Any updates on release dates would be greatly appreciated.

Thanks


On Jan 13, 12:05 pm, James, Justin justin.ja...@intel.com wrote:
 Do you happen to know what the timeline is for NH 2.1 GA?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---



Re: Is Castle project still alived and stable?

2009-01-13 Thread Tuna Toksöz
Here is the link

http://groups.google.com/group/nhibernate-development/browse_thread/thread/9e545846d887393a/05eb0904b3a31191


Tuna Toksöz
http://tunatoksoz.com

Typos included to enhance the readers attention!



On Tue, Jan 13, 2009 at 8:35 PM, Tuna Toksöz tehl...@gmail.com wrote:

 It is like after May, IIRC

 Tuna Toksöz
 http://tunatoksoz.com

 Typos included to enhance the readers attention!



 On Tue, Jan 13, 2009 at 7:05 PM, James, Justin justin.ja...@intel.comwrote:


 Do you happen to know what the timeline is for NH 2.1 GA?

 Justin

 -Original Message-
 From: castle-project-users@googlegroups.com [mailto:
 castle-project-us...@googlegroups.com] On Behalf Of Markus Zywitza
 Sent: Tuesday, January 13, 2009 4:46 AM
 To: castle-project-users@googlegroups.com
 Subject: Re: Is Castle project still alived and stable?


 2009/1/12 Floyd Wu floyd...@gmail.com:
  Thanks a lot. I like Castle but for some reason I just wanna know when
 will
  be next release. :)

 ActiveRecord 1.0 Final will be released when NH 2.1GA is available.

 -Markus



 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Castle Project Users group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~--~~~~--~~--~--~---