Databinding problem !!!

Posts   
 
    
Banane avatar
Banane
User
Posts: 67
Joined: 01-Sep-2004
# Posted on: 09-Mar-2005 15:45:37   

Hi, I updated my version of LLBLGen pro recently. The old version that I had was one that I got last summer. I regenarated my code with the new IDE.

I'm using the ObjectID has the pk of my grids (dataKeyField = 'ObjectID'). It was working fine before I get the new version and now my application is broken.

How can I resolve the problem?

here is the error

DataBinding: 'MyProject.BusinessObjects.EntityClasses.ItemEntity' does not contain a property with the name 'ObjectID'. 

tx

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-Mar-2005 20:45:12   

These properties are now hidden, i.e.: they were marked hidden already, but some grids, like infragistics, did show them. All entities now implement ICustomTypeDescriptor so they're not showing up anymore.

You used the ObjectID property of the entities for databinding related code?

Frans Bouma | Lead developer LLBLGen Pro
Banane avatar
Banane
User
Posts: 67
Joined: 01-Sep-2004
# Posted on: 09-Mar-2005 20:57:11   

Yes i'm using it as the primary key of each of the row in our grids...

It was very cool for our grids because we are working in memory..so we can add many entities to the collection...and when the user is ready.... he clicks save to push the new added entities in the db.

So by adding ObjectId as the DataKeyField, it was creating Unique Keys by itself on binding. sunglasses

what can I do to continue to support my grids?? Do I have to get an old version of LLBL or can I override something?

tx a lot

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Mar-2005 11:43:49   

Banane wrote:

Yes i'm using it as the primary key of each of the row in our grids...

It was very cool for our grids because we are working in memory..so we can add many entities to the collection...and when the user is ready.... he clicks save to push the new added entities in the db.

So by adding ObjectId as the DataKeyField, it was creating Unique Keys by itself on binding. sunglasses

what can I do to continue to support my grids?? Do I have to get an old version of LLBL or can I override something?

You can generate an ObjectID property into the entity classes, which simply does: public new Guid ObjectID { get { return base.ObjectID;} }

Use an include template bound to the Custom_ template id of the entity class you use, thus if you want to add it to adapter classes, you have to bind the template to Custom_EntityAdapterTemplate.

Frans Bouma | Lead developer LLBLGen Pro
Banane avatar
Banane
User
Posts: 67
Joined: 01-Sep-2004
# Posted on: 10-Mar-2005 14:42:10   

it doesn't sound very easy to do! confused

I guess I have to download the template studio to do that?

I'm using self-servicing

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Mar-2005 16:39:59   

Banane wrote:

it doesn't sound very easy to do! confused

I guess I have to download the template studio to do that?

I'm using self-servicing

No, it's very easy. You can do it in notepad if you'd like. (selfservicing, C#, SqlServer). If you're using VB.NET, you've to replace C# with VB.NET here and there - go to <llblgen pro folder>\drivers\sqlserver\templates - create a copy of CSharpTemplateSet.config and call it MyCSharpTemplateSet.config - open MyCSharpTemplateSet.config in notepad - Alter the <name> tag so you will recognize it in LLBLGen Pro - Right below the last templateBinding tag, you add: <templateBinding templateID="Custom_EntityBaseTemplate" templateFilename="......\SharedTemplates\C#\myEntityInclude.template" /> and save the file - goto <llblgen pro folder>\SharedTemplates\C# and add a textfile called myEntityInclude.template. - open myEntityInclude.template in notepad and add:

public new Guid ObjectID { get { return base.ObjectID;} }

and save the file.

voila simple_smile . Now use the template set config you've just created (recognizable by the changed name tag value) and you'll get that property in every entity class.

Frans Bouma | Lead developer LLBLGen Pro
Banane avatar
Banane
User
Posts: 67
Joined: 01-Sep-2004
# Posted on: 10-Mar-2005 18:09:19   

You're THE man ! smile

This is powerful !!! INCROYABLE !

tx a lot

I have only changed the return type for string because datakeyfields don't like guids flushed


        
        /// <summary>
        /// Return the base ObjectID as a string
        /// </summary>
        public new string ObjectID
        {
            get { return base.ObjectID.ToString(); }
        }
        

tx again