This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, Please, how to acess to different entity relationships using T4 templates ? Thanks in advance. |
|
|
Please see: http://www.mindscape.co.nz/blog/index.php/2010/04/12/using-t4-templates-with-lightspeed/ And here is an example from one of our customers which illustrates some of the object model: http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=3070&PostID=11067 |
|
|
Dear Ivan, Thanks for reply. Now, I can browse OneToMany and OneToOne associations from an Entity using ExpectedDbOneToManyAssociations and ExpectedDbOneToOneAssociations properties ... BUT, what about ThroughAssociations ??? I can't find a ExpectedDbThroughAssociations properties and ThroughAssociations has 0 item ... Can you help me ? Jo. |
|
|
The ExpectedDb* properties are for database synchronisation and should not be used for modelling. To get information about associations, you need to use a weird static method (due to the way Visual Studio represents these things) on the association class, e.g.: OneToManyAssociation.GetLinksToOneToManyAssociations(Entity source) And similarly you would have ThroughAssociation.GetLinksTo... methods for the TAs. This basically applies to any arrow in the diagram: use the static method on the arrow class instead the instance property on the endpoint class. See http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=3070&PostID=10468 for more examples. I found this thread: http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=3070 which covers a lot of the issues customers have run into when working with T4. Since we don't currently provide documentation for the designer object model, this may be worth a read to get a bit more of a picture of the, er, quirks of that object model and the issues that you may run into when working with it. |
|
|
Hello, Thanks for above links. Now, I'm trying to retrieve Backreference Custom Attributes of an OneToManyAssociation in T4, but asso.BackreferenceCustomAttributes returns an empty string whereas the same OneToManyAssociation in the Designer contains a value in the Back ReferenceCustom Attributes property ... Can you help me please ? Jonathan. |
|
|
"CustomAttributes" properties of type string are used internally to support the Visual Studio property grid. You will need to use the equivalent "ClrAttributes" property instead -- in this case assoc.BackreferenceClrAttributes. Yes, we realise this is confusing... |
|
|
Thanks !!! |
|