Re: AR + Selecting just parent
Do have a Lazy attribute in the type or the activerecord-tag in the configuration which switches off lazy-loading? Having a lazy relationship won't load the items in the colelction until the collecion is used. Note: Looking with a debugger at the Client makes the proxy load the children as the debugger accesses the collection... -Markus 2009/7/8 Cesar Sanz the.email.tr...@gmail.com Sorry if not clear.. ** Client HasMany Products ** When I do Client.FindAll() foreach client loaded all the products that belongs to the client get loaded too, My relationship is decored witht [Lazy = true] attribute, because I want it to be like this. Can I use the attribute and be able to fetch just clients.. without products..?? - Original Message - *From:* Tuna Toksoz tehl...@gmail.com *To:* castle-project-users@googlegroups.com *Sent:* Tuesday, July 07, 2009 4:51 PM *Subject:* Re: AR + Selecting just parent *The point is, I want to retrieve just Clients, not their related products.. but I still want to make this relationship not to be lazy loaded.* What? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Tue, Jul 7, 2009 at 3:45 PM, the.email.tr...@gmail.com the.email.tr...@gmail.com wrote: The point is, I want to retrieve just Clients, not their related products.. but I still want to make this relationship not to be lazy loaded. --~--~-~--~~~---~--~~ 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: AR question - deep hierarchy....
You could look into enabling insert/update statement batching within NHibernate, as outlined here: http://davybrion.com/blog/2008/10/batching-nhibernates-dm-statements/ You may need to change your stategy for id generation though: http://nhforge.org/blogs/nhibernate/archive/2009/05/21/using-the-guid-comb-identifier-strategy.aspx hth Dan On Jul 7, 3:47 am, Michael Yeaney michael.yea...@gmail.com wrote: Thanks for the suggestion, Brian. Believe me, I've been itching to do just that, but the other half of my brain has been saying No, let the ORM do it's job. I didn't think there was a way to avoid it with an ORM, but I had to check. The inserts are performed based on change notifications received from a file system that is monitored for known file types. When a notification is received, the end result is that the file is read, parsed, and stored with a version stamp in the DB. So, ultimately, this doesn't happen ~that~ often (generally around 1-2 requests per second), but I just wanted to check and see if there were any caveats to be aware of in a scenario like this. Thanks so much! Michael Y. On Mon, Jul 6, 2009 at 10:07 PM, Brian DeMarzo bdema...@gmail.com wrote: Thought: Override the SAVE method for the Project. Serialize your objects to XML, then send the serialized XML to a sproc. Overly simplistic suggestion, granted, but there's no way to avoid an ORM doing individual INSERTs for each object. That being said, how often are you creating such complex projects? If it's only occasionally, is 2-5 seconds that bad? Does the time to save really slow down the users, or cause locking problems on the DB? - Brian On Jul 6, 4:05 pm, Michael Yeaney michael.yea...@gmail.com wrote: Question for the AR experts out there. I'm working with an object hierarchy that is (roughly) defined as such: Project - Has Properties - Has Categories Category - Has Properties - Has (Sub) Categories - Has a type (enum) Property - Has DataItems - Has a type (enum) DataItem - Has Name - Has InternalName - Has Value - Has InternalValue I've got everything working with AR, but the insert implimentation is really bothering me. The project object(s) I'm saving to the DB contain 40 - 50 categories, each with ~100 properties. As you can probably imagine, this is resulting in an * enormous* amount on INSERT's being issued to the DB (over the wire), in total taking 2 - 5 seconds. In the old days, I would have hand-rolled this insert to use XML (I'm on SQL Server 2005), and sent the entire graph in with one call over the wire. Has anybody run into this before, and is this normal? It doesn't feel good at all...or, is there an AR optimization that I'm not familiar with that can help here? Cheers, and thanks for you time... Michael Y. --~--~-~--~~~---~--~~ 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: AR + Selecting just parent
Hi, thanks for answering.. I dont know what is happening, let me show you my model.. [Operator] Has Many [Client] [Client] Has Many [Product] Here is Operator Model [ActiveRecord(operators, Schema = dbo)] public class Operator { ... [HasMany(typeof (Client), Cascade = ManyRelationCascadeEnum.None, Lazy = true)] public virtual IListClient Clients { get { return _clients; } set { _clients = value; } } } Here is Client Model [ActiveRecord(clients, Schema = dbo)] public class Client { ... [HasMany(typeof (Product), Cascade = ManyRelationCascadeEnum.All, Lazy = true)] public virtual IListProduct Products { get { return _products; } set { _products = value; } } [BelongsTo(Operator)] public virtual Operator Operator { get { return _operator; } set { _operator = value; } } } Here is Product Model [ActiveRecord(products, Schema = dbo)] public class Product { ... [BelongsTo(ClientId)] public virtual Client Client { get { return this._client; } set { this._client = value; } } } When I execute this method... public static Client[] GetClientFromList(IListString cifList) { ICollection inClause = (System.Collections.ICollection)cifList; SimpleQueryClient q = new SimpleQueryClient(from Client c where c.Cif in (:cifs)); q.SetParameterList(cifs, inClause); return q.Execute(); } The result I see using hb profile is Do you see?? My database got hit so many time, and updated too.. Don't know why.. Please help me out. - Original Message - From: Markus Zywitza To: castle-project-users@googlegroups.com Sent: Wednesday, July 08, 2009 12:54 AM Subject: Re: AR + Selecting just parent Do have a Lazy attribute in the type or the activerecord-tag in the configuration which switches off lazy-loading? Having a lazy relationship won't load the items in the colelction until the collecion is used. Note: Looking with a debugger at the Client makes the proxy load the children as the debugger accesses the collection... -Markus 2009/7/8 Cesar Sanz the.email.tr...@gmail.com Sorry if not clear.. ** Client HasMany Products ** When I do Client.FindAll() foreach client loaded all the products that belongs to the client get loaded too, My relationship is decored witht [Lazy = true] attribute, because I want it to be like this. Can I use the attribute and be able to fetch just clients.. without products..?? - Original Message - From: Tuna Toksoz To: castle-project-users@googlegroups.com Sent: Tuesday, July 07, 2009 4:51 PM Subject: Re: AR + Selecting just parent The point is, I want to retrieve just Clients, not their related products.. but I still want to make this relationship not to be lazy loaded. What? Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Tue, Jul 7, 2009 at 3:45 PM, the.email.tr...@gmail.com the.email.tr...@gmail.com wrote: The point is, I want to retrieve just Clients, not their related products.. but I still want to make this relationship not to be lazy loaded. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- inline: profiler.GIF
Re: AR + Selecting just parent
This query hits db for the OPERATOR relation and it is not lazy, it seems. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, Jul 8, 2009 at 6:25 PM, Cesar Sanz the.email.tr...@gmail.comwrote: [ActiveRecord(clients, Schema = dbo)] public class Client { ... [HasMany(typeof (Product), Cascade = ManyRelationCascadeEnum.All, Lazy = true)] public virtual IListProduct Products { get { return _products; } set { _products = value; } } [BelongsTo(Operator)] public virtual Operator Operator { get { return _operator; } set { _operator = value; } } } --~--~-~--~~~---~--~~ 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: AR + Selecting just parent
Do the [BelongsTo(Operator)] admit lazy loading?? It is not just for parent to child relationships? [Operator] is parent of all [Client] so a [Client] BelongsTo [Operator] How do enable lazy loading for that? Another question.. Why is my my Client table getting updated?? - Original Message - From: Tuna Toksoz To: castle-project-users@googlegroups.com Sent: Wednesday, July 08, 2009 9:33 AM Subject: Re: AR + Selecting just parent This query hits db for the OPERATOR relation and it is not lazy, it seems. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, Jul 8, 2009 at 6:25 PM, Cesar Sanz the.email.tr...@gmail.com wrote: [ActiveRecord(clients, Schema = dbo)] public class Client { ... [HasMany(typeof (Product), Cascade = ManyRelationCascadeEnum.All, Lazy = true)] public virtual IListProduct Products { get { return _products; } set { _products = value; } } [BelongsTo(Operator)] public virtual Operator Operator { get { return _operator; } set { _operator = value; } } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- inline: profiler.GIF
Re: AR + Selecting just parent
mmm.. don't see it in any place.. :( Well, I will try by my own. Thanx - Original Message - From: Tuna Toksoz To: castle-project-users@googlegroups.com Sent: Wednesday, July 08, 2009 9:49 AM Subject: Re: AR + Selecting just parent There is lazy loading for many-to-one, I believe. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, Jul 8, 2009 at 6:39 PM, Cesar Sanz the.email.tr...@gmail.com wrote: Do the [BelongsTo(Operator)] admit lazy loading?? It is not just for parent to child relationships? [Operator] is parent of all [Client] so a [Client] BelongsTo [Operator] How do enable lazy loading for that? Another question.. Why is my my Client table getting updated?? - Original Message - From: Tuna Toksoz To: castle-project-users@googlegroups.com Sent: Wednesday, July 08, 2009 9:33 AM Subject: Re: AR + Selecting just parent This query hits db for the OPERATOR relation and it is not lazy, it seems. Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Wed, Jul 8, 2009 at 6:25 PM, Cesar Sanz the.email.tr...@gmail.com wrote: [ActiveRecord(clients, Schema = dbo)] public class Client { ... [HasMany(typeof (Product), Cascade = ManyRelationCascadeEnum.All, Lazy = true)] public virtual IListProduct Products { get { return _products; } set { _products = value; } } [BelongsTo(Operator)] public virtual Operator Operator { get { return _operator; } set { _operator = value; } } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- inline: profiler.GIF
AR Lazy Loading Don't Work
Hello, I have a question about Lazy Loading.. I have a simple parent-children model [Operator] has many [Client] [Client] has many [Product] so [Operator] --| [Client] ---| [Product] When I do, Client.FindAll, I retrieves all the Operators.. and don't know why. I have decorated all my classes with Lazy = true [ActiveRecord(operators, Schema = dbo, Lazy = true)] public class Operator { ... } [ActiveRecord(clients, Schema = dbo, Lazy = true)] public class Client {...} Can some body explain me this issue.. --~--~-~--~~~---~--~~ 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: Compiling Castle Microkernel and Windsor for Silverlight 2.0
Jono Thanks for your continued work on this. I look forward to seeing what you come up with. Nigel. On Jul 5, 12:59 pm, imran imu...@gmail.com wrote: Jono,http://www.flawlesscode.com/post/2008/08/Mocking-and-IOC-in-Silverlig... has done some work on this. Mabe some of it can be reused? Imran --~--~-~--~~~---~--~~ 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: Compiling Castle Microkernel and Windsor for Silverlight 2.0
Thanks imran for the link, we have used some things from that attempt. Castle has moved on quite a bit from then and things need to be done properly with #if, but it is a good start. Nigel, thanks. I'm not sure if I'll get a chance to do much more but in the near future. On Thu, Jul 9, 2009 at 7:31 AM, Nigel nigel.jeffer...@gmail.com wrote: Jono Thanks for your continued work on this. I look forward to seeing what you come up with. Nigel. On Jul 5, 12:59 pm, imran imu...@gmail.com wrote: Jono, http://www.flawlesscode.com/post/2008/08/Mocking-and-IOC-in-Silverlig... has done some work on this. Mabe some of it can be reused? Imran -- Jono --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pre-compiling Brail for Medium Trust Environments (Mosso)
I am unable to get on the fly compilation working correctly for boo. The Reflection.Emit issue has been solved on the boo trunk. Plus Mosso just allowed reflection.emit anyway. However, boo's CompilerParameters makes use of Assembly.Location. The medium trust environment doesn't allow FiIeIOPermission outside of the site's root dir. So, I need to precompile brail, preferably with a nant task. Ayende says it is possible but I can't figure out how! #1) I am trying to generate the assemblies using StandaloneBooViewEngine: [TaskName(compilebrail)] public class CompileBrail : Task { protected override void ExecuteTask() { BooViewEngineOptions options = ConfigurationManager.GetSection (brail) as BooViewEngineOptions; StandaloneBooViewEngine engine = new StandaloneBooViewEngine(new FileAssemblyViewSourceLoader(Views), options); engine.Process(home/index, TextWriter.Null, new Hashtable()); } } However the engine whines that objects like siteRoot are missing, I guess because there's nothing in the propertybag. Also, I don't want to have to supply all the view names in the build process. It should just scan the view directory and do it. #2) I also tried turning off trust, hitting all the pages then turning it back on. However, after looking at the code I don't think this will work either as the engine won't check SaveDirectory when it starts up. I am fine with working on a patch, I just wanted to make sure I wasn't missing anything first! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Why AR is Updating When Performing a Select
Hello.. I am in a hurry cuz I have to release a small project. I use AR for this project, my model is simple, [Client] has many [Product] This is used in a web application, so a new session is opened on each request. The point is.. when I perform a Client.FindAll() it select all the clients (which is desirable) but at the end of the request, I can see AR is updating each and every client that found.. I see no changes are really made.. So, I don't know what is happening under the hood.. I appreciate any kind of help. Best regards --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---