Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Fields mapped on related fields field index
 

Pages: 1
LLBLGen Pro Runtime Framework
Fields mapped on related fields field index
Page:1/1 

  Print all messages in this thread  
Poster Message
alexdresko
User



Location:
Greenville, SC
Joined on:
08-Jun-2004 17:30:02
Posted:
336 posts
# Posted on: 19-Oct-2006 20:15:08.  
Let's say I have an ApplicantCertification entity with a CertificationDescription field mapped as a field on related field from Certification.Description.

My problem is, CertificationDescription isn't in the ApplicantCertificationFieldIndex enumeration. Is there an enumeration somewhere with this item?

Alt
ernatively, maybe someone could tell me how to get "CertificationDescription" as a string from an existing entity.. For example, would it be possible to create a function called GetPropertyNameString that satisfies the test below?

Code:

Dim appCert As New ApplicantCertification()
Assert.IsTrue(GetPropertyNameString(appCert.CertificationDescription) = "CertificationDescription")


Sorry for all the weird questions lately. It has a lot to do with making data binding in our app more type-safe..
I'm not a player, I just code a lot.   Top
bclubb
User



Location:
Norman, Oklahoma
Joined on:
12-Feb-2004 22:18:04
Posted:
934 posts
# Posted on: 20-Oct-2006 02:54:36.  
http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=3306&HighLight=1

Is this similar to your question? If you could provide more explanation as to why you need the index and the string it may be easier to give you the solution.


  Top
alexdresko
User



Location:
Greenville, SC
Joined on:
08-Jun-2004 17:30:02
Posted:
336 posts
# Posted on: 20-Oct-2006 15:46:25.  
bclubb wrote:
http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=3306&HighLight=1

Is this similar to your question? If you could provide more explanation as to why you need the index and the string it may be easier to give you the solution.

We're using Infragistics grids in our app, binding an enititycollection directly do it. Every column in an Infragistics grid is accessible with a key, and since we don't know which columns will be displayed at runtime, we have toiterate over the coloumns to determine which are available. Here's some code..

Code:

        For Each ugc As UltraGridColumn In grdMain.DisplayLayout.Bands(0).Columns
            Select Case ugc.Key
                Case ApplicantCertificationInformationFieldIndex.CertificationCodeMasterId.ToString()
...

                Case "CertificationDescription"
......


Notice the key is the same as the property name in the entity. Well, if the fields on related fields property isn't in the FieldIndex, I end up having to hard code the values.

Hard coding = bad.
I'm not a player, I just code a lot.   Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37373 posts
# Posted on: 20-Oct-2006 17:38:36.  
You can determine which fields are visible as properties, by using the entitycollection's code to produce propertydescriptors. As you bind the entitycollection directly to the grid, I assume you're using 1.0.2005.1/.net 1.x. If you're using v2.0 (we can't keep track of that ourselves, please state this with your posts... ), you've to use an EntityView2, as ITypedList is implemented on that, but it works roughly the same. (you then call EntityView2.GetPropertyDescriptors(dummy, null); )

So typically you do:
Code:
EntityCollection dummyCol = new EntityCollection(new ApplicantCertificationEntityFactory());
IEntity2 dummy = new ApplicantCertificationEntity();
PropertyDescriptorCollection propertyDescriptors = dummyCol.GetPropertyDescriptors(dummy, typeof(ApplicantCertificationEntity));


If you don't want collection properties to be present, use the overload which accepts skipCollections (boolean), and pass in true.

this gives property descriptors for all properties which are visible in the entity, and which are useful, so properties which would be reported back to a grid if you bound dummyCol to it.

You can then walk the properties, and use the names for columns.



Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


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

Version: 2.1.12172008 Final.