Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Dynamic creation of FieldInfo
 

Pages: 1
LLBLGen Pro Runtime Framework
Dynamic creation of FieldInfo
Page:1/1 

  Print all messages in this thread  
Poster Message
simon831
User



Location:

Joined on:
19-Jan-2006 18:45:31
Posted:
152 posts
# Posted on: 28-Aug-2007 15:16:51.  
I want to dynamically create a bucket object from user selection in a dropdown list.
This is the approach I am taking, but I cannot figure out how to create a FieldInfo object based on a string.
Can this be made to work or is there a better way?
Code:


            //get the values from the dropdown selecteditem
            string fieldName = "OrderId";
            string containingObjectName = "OrderEntity";

            IRelationPredicateBucket bucket = new RelationPredicateBucket();
            PredicateExpression filter = new PredicateExpression();
            IPredicateExpression predicateExpression = new PredicateExpression();
            
        //this line does not work
        FieldInfo fieldInfo = new FieldInfo(fieldName, containingObjectName);

            EntityField2 ent = new EntityField2(fieldInfo);
            Predicate predicate = ent == valueTextBox;
            predicateExpression.Add(predicate);
            filter.Add(predicateExpression);
            bucket.PredicateExpression.Add(filter);

  Top
jmeckley
User



Location:
Harrisburg, PA, USA
Joined on:
05-Jul-2006 16:03:19
Posted:
403 posts
# Posted on: 28-Aug-2007 17:06:43.  
Code:
//get the values from the dropdown selecteditem
string fieldName = "OrderId";
string containingObjectName = "OrderEntity";

IRelationPredicateBucket bucket = new RelationPredicateBucket();
PredicateExpression filter = new PredicateExpression();
IPredicateExpression predicateExpression = new PredicateExpression();
            
EntityField2 ent = EntityFieldFactory.Create(containingObjectName, fieldName);
Predicate predicate = ent == valueTextBox;
predicateExpression.Add(predicate);
filter.Add(predicateExpression);
bucket.PredicateExpression.Add(filter);

which could be simpifilied to this
Code:
//get the values from the dropdown selecteditem
string fieldName = "OrderId";
string containingObjectName = "OrderEntity";

EntityField2 ent = EntityFieldFactory.Create(containingObjectName, fieldName);
IRelationPredicateBucket bucket = new RelationPredicateBucket(ent == valueTextBox);


Jason Meckley
Programmer
 
Top
JimHugh
User



Location:
Davis, CA
Joined on:
16-Nov-2005 14:32:25
Posted:
191 posts
# Posted on: 28-Aug-2007 17:33:29.  
Not OP, but was interested. Need to make EntityField2 IEntityField2 to make it compile.

(edit) and then cast the ent to EntityField2.
Code:

            string fieldName = "OrderId";
            string containingObjectName = "OrderEntity";

            IEntityField2 ent = EntityFieldFactory.Create(containingObjectName, fieldName);
            IRelationPredicateBucket bucket = new RelationPredicateBucket((EntityField2) ent == valueTextBox);
Jim Hughes  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.