CodeSmith Community
Your Code. Your Way. Faster!

WinForms databinding on many-to-many relashionship

Latest post 04-09-2007 6:41 AM by keithmd. 2 replies.
  • 02-06-2007 6:14 AM

    • Lex
    • Top 50 Contributor
    • Joined on 09-28-2006
    • Posts 72
    • Points 1,945

    WinForms databinding on many-to-many relashionship

    Hi,

    Could someone explain how to deal with databinding on many-to-many relashionship ?

    Especially : can this work on ListBox, CheckedListBox ans TreeView native/custom controls ?

    Thanks

    • Post Points: 65
  • 04-05-2007 6:16 PM In reply to

    Re: WinForms databinding on many-to-many relashionship

    I'm very interested in the answer to these questions as well.

    Thanks in advance,

    Steve

    • Post Points: 5
  • 04-09-2007 6:41 AM In reply to

    • keithmd
    • Not Ranked
    • Joined on 04-02-2007
    • Posts 4
    • Points 20

    Re: WinForms databinding on many-to-many relashionship

    How do you mean? I believe nettiers objects support loading data for many to many relationships via Entity.[ChildType]Collection and Entity.[Type]_Collection_From_[ChildType]. If you deep load all these (ChildType and Type) and use a binding source (or anything that has a currency manager) then you should be able to bind without any hustles. e.g if you have the types User, UserRole and Role in a many to many relationship you can deep load using:

    UserService userService = new UserService();

    User user = userService.GetByUserID(1);

    userService.DeepLoad(user, true, Data.DeepLoadType.IncludeChildren, new Type[] {typeof(TList<UserRole>), typeof(TList<Role>) });

    Use two binding sources UsersBS and RolesBS. Set UserBS.DataSource = user and RoleBS.DataSource = user.RoleCollection_From_UserRole.

    This should work. 


     

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems