Hi, all
In my visual studio add-in application, I walk through the current projects and fetch a specified codeclass2 object. Now I need to fetch all the generic properties. But I don't know how to get them. Below is my code:
CodeClass2 db = GetContainerDefinition(containerName);
foreach (CodeElement item in db.Members)
{
if (item.Kind == vsCMElement.vsCMElementProperty)
{
CodeProperty2 p = item as CodeProperty2;
string strAttr = "name: " + item.Name + "; type: " + p.IsGeneric + "; " ;
foreach (CodeElement parameter in p.Parameters)
{
strAttr = strAttr + parameter.Name;
}
}
}Below is my class for test:
namespace Workflow.Models
{
using System;
using System.Data.Entity;
public partial class WorkflowContainer : DbContext
{
public WorkflowContainer()
: base("name=WorkflowContainer")
{
}
public DbSet<Doctemplatetype> Doctemplatetypes { get; set; }
public DbSet<Nodevaluetype> Nodevaluetypes { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<doctemplate> doctemplates { get; set; }
public DbSet<docrole> docroles { get; set; }
public DbSet<doctemplatecell> doctemplatecells { get; set; }
public DbSet<doctemplatecontent> doctemplatecontents { get; set; }
public DbSet<flowtemplate> flowtemplates { get; set; }
public DbSet<flowversion> flowversions { get; set; }
public DbSet<doctemplateuser> doctemplateusers { get; set; }
public DbSet<docroleuser> docroleusers { get; set; }
public DbSet<docinstance> docinstances { get; set; }
public DbSet<noderelationship> noderelationships { get; set; }
public DbSet<flowinstance> flowinstances { get; set; }
public DbSet<accessrec> accessrecs { get; set; }
public DbSet<flowtemplatecell> flowtemplatecells { get; set; }
public DbSet<groupuser> groupusers { get; set; }
public DbSet<usergroup> usergroups { get; set; }
public DbSet<form> forms { get; set; }
public DbSet<previewform> previewforms { get; set; }
public DbSet<forminput> forminputs { get; set; }
public DbSet<docresult> docresults { get; set; }
public DbSet<roleinstance> roleinstances { get; set; }
public DbSet<componentgroup> componentgroups { get; set; }
public DbSet<formcomponentcontainer> formcomponentcontainers { get; set; }
public DbSet<forminputitem> forminputitems { get; set; }
public DbSet<formline> formlines { get; set; }
public DbSet<forminputotheritem> forminputotheritems { get; set; }
public DbSet<formcontaineroptionline> formcontaineroptionlines { get; set; }
public DbSet<formcontaineroption> formcontaineroptions { get; set; }
public DbSet<formoptionline> formoptionlines { get; set; }
public DbSet<formoption> formoptions { get; set; }
}
}Obviously, there are so many generic properties, but the p.IsGeneric is false always. So how can I get the generic properties?
Thanks