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 IList<Client> 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 IList<Product> 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(IList<String> cifList)

        {

            ICollection inClause = (System.Collections.ICollection)cifList;

            SimpleQuery<Client> q = new SimpleQuery<Client>("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: [email protected] 
  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 <[email protected]>

    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: [email protected] 
      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, [email protected] 
<[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---

<<inline: profiler.GIF>>

Reply via email to