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 - we've tried using the dto generation stuff - works ok but i would rather have a separate contract/data assembly for wcf. so - we're using t4 templates to generate the dtos. works fine and means i can have the dtos in a separate assembly (but generated off the model). question: i've got some entity inheritance in the model. currently working fine for STI but not sure how to determine whether an entity is a ConcreteCti base class...? this works for STI entities: public <# if(entity.IsStiRoot) { #>abstract <# } #>class <#= entity.Name #><# if(entity.IsStiChild) { #> : <#= entity.BaseClass.Name #><# } #> but there doesn't seem to be an equivalent entity.IsCtiRoot property. (this is in the MS.LS.Generator.Integration.Dsl assembly). basically i would like an easy way of determining whether an entity should be marked up as abstract or not... thanks justin |
|
|
A rule of thumb is that anything that is represented by an arrow in the diagram is represented by a static method of the form Xxx.GetLinksToYyy, where Xxx is the kind of relationship and Yyy is the internal name of the collection. In the case of an inheritance relationship, the method you need is: BaseToDerivedAssociation.GetLinksToDerivedClasses(entity); This will return a collection of BaseToDerivedAssociation objects representing the inheritance arrows from entity to each of its derived classes. This gives you access to the InheritanceType property which will tell you whether it is using single, concrete or class table inheritance. (You can often guess what Xxx and Yyy might be by looking at the XML for a relationship of the relevant kind. For example, if you look at the the .lsmodel file for an inheritance relationship, you'll see <baseToDerivedAssociation> elements [the relationship type] inside a <derivedClasses> element [the collection name]. This tends to work only in one direction though!) |
|