How to Identify Element type in DeploymentPlanModifier ?
-
Donnerstag, 2. August 2012 17:30
I am trying to customize the deployment plan to suit my need, I am wondering how to identify the element type in OnExecute?
e.x. StoredProcedure, Table, Function ?
protected override void OnExecute(DeploymentPlanContributorContext context) { DeploymentStep currentStep = context.PlanHandle.Head; while (currentStep != null) { // How to identify what elment type is this ? // e.g StoredProcedure, Table, Function, Column etc } }Can anyone please help me?
Thameem
Alle Antworten
-
Freitag, 3. August 2012 07:18Moderator
Hi Thameem,
I think that you need to use the UserInteractionServices.GetElementTypeDescription method to get the element type. Maybe you can have your code to be similar to:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Data.Schema.Build; using Microsoft.Data.Schema.SchemaModel; namespace MyOtherDeploymentContributor { public class Class1 : DeploymentPlanModifier { protected override void OnExecute(DeploymentPlanContributorContext context) { DeploymentStep currentStep = context.PlanHandle.Head; while (currentStep != null) { DropElementStep dropStep = currentStep as DropElementStep; IModelElement sourceElement = dropStep.TargetElement; string type= context.Source.DatabaseSchemaProvider.UserInteractionServices.GetElementTypeDescription(sourceElement.ElementClass); } } } }Thanks.Vicky Song [MSFT]
MSDN Community Support | Feedback to us
- Als Antwort markiert Thameem Freitag, 3. August 2012 11:16
-
Freitag, 3. August 2012 11:18
Thanks a lot Vicky, It seems to be working!
Another question way different from the topic, Is there a way to debug this?
Thameem
-
Dienstag, 7. August 2012 02:04Moderator
Hi Thameem,
I personally think that to debug it should be similar to debug a normal C# project. For further information about debugging, you can consult bebug support engineer directly on this forum: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/threads
Thanks.
Vicky Song [MSFT]
MSDN Community Support | Feedback to us

