public create method question

public create method question

Old forum URL: forums.lhotka.net/forums/t/513.aspx


NelsonF posted on Thursday, June 29, 2006

I have a data grid from Developer Expres that allows the creation of rows inline. In other words I can click on a new row in the grid and populate the record directly. The problem is that it seems to requrie that the object has a public constructor to make an instace of the object for the new row.
I know the CSLA framework wants to use a private constructor. I tried making the constructor public and it seems to work but I'm wondering if there are any other implications I should be aware of.
 

Fabio replied on Thursday, June 29, 2006

 You don't need a public constructor.
The grid use a bindingSource and you can use the event AddingNew or, much more better, you can override the AddNewCore() method of your implementation of a concrete BusinessList.

    #region BindingList
    protected override object AddNewCore()
    {
      Agency item = Agency.NewAgency();
      Add(item);
      return item;
    }
    #endregion


Bye.
Fabio.

Copyright (c) Marimer LLC