Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Custom Templates> IsMappedOnResultset equivalent on Lpt templates
 

Pages: 1
Custom Templates
IsMappedOnResultset equivalent on Lpt templates
Page:1/1 

  Print all messages in this thread  
Poster Message
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 04-Apr-2012 23:23:15.  
Is there any equivalent in .lpt to the TDL [If IsMappedOnResultset] token?
I have looked into TypedViewDefinition object, but I cannot find anything similar.

Of course I could set a CustomProperty, but it seems a bit weird.

Update: It seems to be defined in the SD.LLBLGen.Pro.DBDriverCore.ProjectElementMapTargetElementType enum, and that could be retrieved by GroupableModelElementMapping.MappedTarget.ElementType, but I don't know how to get to a GroupableModelElementMapping from a TypedViewDefinition

TIA,
Jose
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 05-Apr-2012 09:40:16.  
Not sure but I think you need the TypedViewMappings which you can cast to GroupableModelElementMapping. So you get all TypedViews mapping information which you can query upon.

Please check this specific post:
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=19171&StartAtMessage=0&#107971


  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 05-Apr-2012 16:40:56.  
Cool!!!
Here is the code:
Code:
var databaseMappingData = _executingGenerator.ProjectDefinition.MappingData.MappingDataPerDriverID
                    .FindByKey(_executingGenerator.DriverID).FirstOrDefault();
var tpvsMappedToSP = databaseMappingData.TypedViewMappings
                    .Cast<GroupableModelElementMapping>()
                    .Where(m => m.MappedTarget.ElementType ==
                         ProjectElementMapTargetElementType.StoredProcedureResultset)
                    .Select(m => m.MappedElement.Name);
bool currentTypedViewMappedToSP = tpvsMappedToSP.Contains(currentTypedView.Name);


As always, superb!
Thanks.
  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 05-Apr-2012 17:01:25.  
Even better:
Code:
TypedViewMapping currentMapping = currentProject.GetGroupableModelElementMapping(currentTypedView, _executingGenerator.DriverID) as TypedViewMapping;
bool currentTypedViewMappedToSP = (currentMapping.MappedTarget.ElementType == ProjectElementMapTargetElementType.StoredProcedureResultset);


  Top
Pages: 1  


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

Version: 2.1.12172008 Final.