Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 967313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:17:42+00:00 2026-05-16T02:17:42+00:00

I have build an Addin for code generation (C#, VS 08) for our team.

  • 0

I have build an Addin for code generation (C#, VS 08) for our team.

The addin creates a new menu entry if i click on a file in the solution explorer.
There i can choose a destination test project where the 2 files are generated to.

For the code generation process i need informations from the selected item in the solution explorer (like Interfaces, generic types of the class declaration).

My source class looks like

public class CustomerLogic : BaseBL<T1, T2, T3>, ICustomerBL

The generated container class

public class CustomerContainer : BaseBLDummyContainer<T1, T2, T3>

The generated dummy class looks like

public class CustomerBLDummy : BaseBLDummy<T1, T2, T3, CustomerContainer>, ICustomer

How i realized it?

I created two templates (container and dummy), put placeholder to the spaces so the two template files look like

Containertemplate

public class $Classname$ : BaseBLDummyContainer<$T1$, $T2$, $T3$>

Dummytemplate

public class $Classname$ : BaseBLDummy<$T1$, $T2$, $T3$, $TContainer$>$, TInterface$

To generate the templates i have writen some code to

  • create the files
  • add them to the destination project
  • create methods if needed

You can see, a “lot” of work to do only to generate some code.

  1. Now i consider if the generation with T4 is a better solution for my situation?
  2. Does i have some benefits of the T4 mechanism ? (I’ve only see some T4 samples in combination with EF or database related generation)
  3. Should i be more flexible with T4?

Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:17:42+00:00Added an answer on May 16, 2026 at 2:17 am

    You don’t need to make an either/or choice here ‘k’, you can mix and match add-ins and T4.

    T4 has a very simple UI binding to Visual Studio out of the box, that just uses the Custom Tool mechanism (IVsSingleFileGenerator) to connect a template file to an output file in the project. (See T4Toolbox community project for more complex output).

    However, T4 also exposes a service interface in VS (STextTemplating/ITextTemplating) that you can use from both VS add-ins and VS packages.

    So you could keep your add-in’s entry point and core way of working, but use T4 to provide the template engine and avoid having to maintain that part yourself. You’d likely use the
    <#@ parameter #> directive to pass replacement parameters in to your template for T1, T2, T3 etc.

    Hope this gives you some ideas for options to move forward.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 523k
  • Answers 523k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer My guess is that by not completing the inner scope… May 16, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer I was able to figure it out using the following… May 16, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer XElement myTable = xdoc.Descendants("table").FirstOrDefault(xelem => xelem.Attribute("class").Value == "inner"); IEnumerable<IEnumerable<XElement>> myRows… May 16, 2026 at 9:38 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a project with a huge amount of auto-generated code, which we build
I have a very simple Excel Addin build it in Visual Studio 2008 for
I am building a lot of auto-generated code, including one particularly large file (~15K
I have few DB tables, witch are build using inheritance from one table witch
During development, I'd like to have an XML file in my iPhone app's Documents
I have a few things that I cannot find a good way to perform
I am using the Configuration Section Designer for .NET to build a simple ConfigurationElementCollection
I'm experimenting with a plugin architecture for my company's internal business system. I have
I have a List<> of objects containing two strings and a DateTime. I want
I have a normal VS2008 project that I've been working on for awhile that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.