Entity databinding

Posts   
 
    
OSSistemes
User
Posts: 19
Joined: 20-Nov-2019
# Posted on: 21-Nov-2019 07:56:19   

Hi,

We are evaluating the ORM, at first - great job! - it'a amazing and it's easy to use and runs very good, but we have a little problem.

The problem is with and Entity with another one nested, if we try to bind the parent, its impossible to obtain datamember inside child.

Exemple:

ArticleEntity Art = new ArticleEntity(1);
BindingSource Formbinding = new BindingSource();
Formbinding.DataSource = Art;
//Lazy Load its ok
FamilyEntity Fam = Art.Family;
    
//textbox databindings
textBox1.DataBindings.Add("Text", Formbinding, "Codi", true, DataSourceUpdateMode.OnValidation);
textBox2.DataBindings.Add("Text", Formbinding, "Descripcio", true, DataSourceUpdateMode.OnValidation);
textBox3.DataBindings.Add("Text", Formbinding, "Family.Nom", true, DataSourceUpdateMode.OnValidation);

At runtime, when we try to bind string inside Art.Family.Nom, the program stop with error:

textBox3.DataBindings.Add("Text", Formbinding, "Family.Nom", true, DataSourceUpdateMode.OnValidation)

"Datamember Family not found in Datasource"

We check this thread, but no solution: https://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=24683&HighLight=1

Please someone can help!!

Thanks!

We use: Framework 4.6.1 Self-servicing MySQL LLBLGen 5.6

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 21-Nov-2019 11:45:22   

I can reproduce it. It's however a winforms databinding issue, but I'll see if I have an answer for you.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 21-Nov-2019 12:14:13   

I can't reproduce it if I move the bindings to the OnLoad override on the form:


using System;
using System.Linq;
using System.Windows.Forms;
using NWDB.EntityClasses;

namespace DBTester
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            _orderIdTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._binding, "OrderId", true));
            _customerCompanyNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this._binding, "Customer.CompanyName", true));
        }


        private void _fetchButton_Click(object sender, EventArgs e)
        {
            var o = new OrderEntity(10262);
            _binding.DataSource = o;
        }
    }
}


Selfservicing, northwind (sqlserver, but doesn't matter), Browsable($false) attribute removed on the navigator.

The datasource is defined in the project on the 'datasources' pane in visual studio.

btw, we recommend to use Adapter over selfservicing. You do lose lazy loading, but adapter offers more features, like batching. Not sure you need those of course, but just in case simple_smile

Frans Bouma | Lead developer LLBLGen Pro
OSSistemes
User
Posts: 19
Joined: 20-Nov-2019
# Posted on: 21-Nov-2019 13:02:47   

At first thanks for response, at this moment we solve it using related fields mapping.

When you said "Browsable($false)" where is the place to check if this option is enable/disable?

We are testing if use self or adapter at this moment

Thanks!

OSSistemes
User
Posts: 19
Joined: 20-Nov-2019
# Posted on: 21-Nov-2019 13:08:15   

We find it!! and check if i removed Browsable($false) all runs ok without related fields

Thanks