I've been unable to find a way to set the Default-Lazy to true
utilizing code and not the XML file.  But I have found an alternative
solution.  It seems that if you set the actual class table to lazy

[ActiveRecord("TBL_Research", Lazy = true)]
    public class Research: ActiveRecordBase
   {

Along with setting the properties and relationships to virtual, it
then doesn't pull back the information therefore enabling a quick
validated save.  I'm not crazy about the solution but for now it
works.  But if anyone happens to know how to set default lazy while
using a InPlaceConfigurationSource and not using XML, I'd appreciate
it if you let me know.

On Aug 14, 2:48 pm, JimmyJamz <[email protected]> wrote:
> Which currently the InPlaceConfigurationSource is as follows --
>
> IDictionary<string, string> properties = new Dictionary<string, string>
> ();
>
>             properties.Add("connection.driver_class",
> "NHibernate.Driver.OracleClientDriver");
>             properties.Add("dialect",
> "NHibernate.Dialect.Oracle10gDialect");
>             properties.Add("connection.provider",
> "NHibernate.Connection.DriverConnectionProvider");
>             properties.Add
> ("proxyfactory.factory_class","NHibernate.ByteCode.Castle.ProxyFactoryFactory,
> NHibernate.ByteCode.Castle");
>             properties.Add("connection.connection_string",
> GetConnectionString());
>
>             InPlaceConfigurationSource source = new
> InPlaceConfigurationSource();
>             source.Add(typeof(ActiveRecordBase), properties);
>
>             return source;
>
> On Aug 14, 2:42 pm, JimmyJamz <[email protected]> wrote:
>
> > Thanks William.
>
> > I'm looking into that now.  However, I'm trying to set the default
> > lazyload to true but I don't use an xml for a configuration, rather I
> > use InPlaceConfigurationSource in the cs file.  I noticed that on the
> > InPlaceConfigurationClass that there is a "SetIsLazyByDefault(bool)"
> > method but it is protected.  Therefore I can't set it to true.  I'm
> > looking into a different way of setting it but if anyone has an idea
> > on how to set it utilizing C# code rather than an xml file.  Please
> > let me know.
>
> > Thanks!
>
> > On Aug 14, 1:24 pm, William Chang <[email protected]> wrote:
>
> > > It's similar to my 
> > > question:http://groups.google.com/group/castle-project-users/browse_thread/thr...
>
> > > Even though, I did not get a chance to try again with Markus Zywitza
> > > solution. This weekend I will.
>
> > > Where I left off resolving, I tried setting default-lazy="true" in my
> > > App.config (modal nunit test) and it did not pull anything off the
> > > database (e.g. SELECT).
>
> > > Sincerely,
> > > William Chang
>
> > > On Aug 14, 1:05 pm, JimmyJamz <[email protected]> wrote:
>
> > > > I upgraded to the latest Active Record a couple days ago and am
> > > > testing out current software that's been developed based on the
> > > > initial beta release of Active Record.  All is well after
> > > > changing .Expression to .Criterion but now it seems that when using
> > > > the ActiveRecordValidationBase class, when saving, it is pulling back
> > > > much more than what is needed.
>
> > > > After some research, it seems that the BelongsTo needs to be set to
> > > > lazy.  So my belongsto on my child class is as follows -
>
> > > > Discovery class--
>
> > > > [BelongsTo("Research_Guid", Lazy = FetchWhen.OnInvoke, Update = false,
> > > > Insert = false)]
> > > >             public Research Research{ get; set; }
>
> > > > On the parent Research table, the HasMany relationship is as follows-
>
> > > > [HasMany(typeof(Discovery), Cascade =
> > > > ManyRelationCascadeEnum.AllDeleteOrphan, Lazy = true, Inverse = true)]
> > > >         public IList<Discovery> Discovery     { get; set; }
>
> > > > Now when I pull back a Discovery object, the Research object comes
> > > > along with it even though I have the lazy set to oninvoke.  So
> > > > whenever I make a change to the Discovery object and do a save, it
> > > > goes up to the parent Research class and then stems out to all other
> > > > relationships that stem off of the Research class where as it should
> > > > just validate the Discovery class and save.
>
> > > > I'm assuming I have the relationship lazy setting wrong somehow but I
> > > > can't seem to figure it out.
>
> > > > Any help is greatly appreciated.
> > > > Thanks
--~--~---------~--~----~------------~-------~--~----~
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