Entity Framework - Winforms How?

Posted by: development on 31 March 2019, 11:49 pm EST

    • Post Options:
    • Link

    Posted 31 March 2019, 11:49 pm EST

    Need help ASAP! (Please forgive the urgency…)

    I need an example of a simple Order/Items (Parent/Child) for CRUD (mainly insert) in Winforms & Entity Framework 6 in C#. The Parent fields on the form have components such as Order Number and Date, and the Child is a FlexGrid with fields: Order Number (Parent Relationship), Amount, Description, Cost. Using VS 2017 Pro and SQL.

    I can’t seem to get the Parent and Child tables to update together. Some tutorials say to use just a C1Datasource, others say to also use a BindingSource… what is the right way?

    Also, how to get the Parent Order Number to be set in the Child Order Number field in the Grid? I was going to set the Order Number field in the grid every time a new row is created, but there must be an easier way…

    Is it best to use design time setting in the properties or set some or all in code?

    Any help would be greatly appreciated.

  • Posted 2 April 2019, 8:08 am EST

    Hello,

    You should use C1.Win.Data.Entities.EntityViewSourceProperties and pass it to C1DataSource’s ViewSourceCollection. Also, to achieve Parent-Child (Master-Detail), you may use two different flexgrids and set their DataMember along with their DataSource properties.

    I have attached a demo application for you to achieve Master-Detail relationship related through CategoryId field.

    Also, though you can either do that in code or designer, using designer is always comparatively easy.

    Hopefully this should help.

    Thanks,

    Ruchir

    C1DataSourceWinForms-C1FlexGrid.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels