Dynamically Creating a Field with LLBLGen 2.5

Posts   
 
    
pat
User
Posts: 215
Joined: 02-Mar-2006
# Posted on: 08-Nov-2007 21:18:47   

Hi,

Otis wrote:

Override in your entity, GetProperties. First call the base method. This will give you property descriptors in a PropertyDescriptorCollection (it's ICustomTypeDescriptor.GetProperties). You then should add a property descriptor for your field. You can use EntityPropertyDescriptor (or EntityPropertyDescriptor2) for that. It's a bit complex, but I think it's doable.

http://www.llblgen.com/TinyForum/GotoMessage.aspx?MessageID=17985&ThreadID=3250

Can I still do this with LLBLGen 2.5? I can't see the GetProperties method.

Basically I would like to add some virtual fields at runtime. These should appear in a datagrid via data binding. The getter and setter for the different virtual properties should all be handled by two methods if possible. For example something like this: object GetVirtualValue(String propertyName) void SetVirtualValue(string propertyName, object value)

Is there any way to do this and if yes how would I do this please?

Thank you,

Patrick

LLBLGen 2.5; SQL Server 2005; C#; VS2005; Adapter Template

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 09-Nov-2007 19:16:41   

This has been moved to the EntityView(2) classes. So you should derive a class from EntityView2 and override GetEntityFieldPropertyDescriptors().

Please check the sourcecode in EntityView2<T> for details. It basicly gets you the properties for the type at hand, so you simply append the property descriptors you want to show as well. That's basicly it simple_smile

Then in your code, you use the derived class as the EntityView2<T> instead of the EntityView2<T> class.

Frans Bouma | Lead developer LLBLGen Pro