Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For what purposes have YOU used T4?

People also ask

What is the purpose of T4?

A T4 test is used to check how well your thyroid is working. It's also used to help diagnose and monitor thyroid disease and conditions that may affect your thyroid, including: Hypothyroidism, or underactive thyroid, which is when your thyroid gland doesn't make enough thyroid hormone to meet your body's needs.

What is T4 and when it is given?

A T4 test measures the blood level of the hormone T4, also known as thyroxine, which is produced by the thyroid gland and helps control metabolism and growth. The T4 test is performed as part of an evaluation of thyroid function.

What is the purpose of T3 and T4?

T3 and T4 work together to regulate how your body uses energy. These hormones also play an important role in controlling your weight, body temperature, muscle strength, and nervous system.


I am not a big fan of the stringy-ness of app.config/web.config, so I use T4 to read those files and make an AppSettings/WebSettings class that wraps the connection strings and key/values in a real class. This means that, as long as I always use AppSettings.SomeValue to reference my app.config, I get compile time checking, which is really nice.


I've used the T4 Templates within the sharp-architecture to generate everything from models to controllers to basic views.

Definitely worth checking out, even if you just want to see some advanced examples of T4 templates in action


I use T4 to:

  1. Generate CRUD SQL Server and Oracle scripts.
  2. Generate Data Access Layer, based on a database schema
  3. Layer Generate Business Logic Layer, based on a database schema
  4. Generate ASP.Net webforms, both HTML and codebehind, based on a database schema (scafolding).

It gives me a good, quick, simple, basic starting point for my projects.

And the best is I'm in control.

Here you can download an example of my templates


SubSonic 3.0 makes heavy use of T4 templates for generating your entity code.

Essentially it calls GetSchema() on your database connection and runs each table it finds through the T4 entity template. The great thing about using T4 here is that if you don't like the way it's handling your database schema, just edit the template.

I've tweaked the T4's to handle MySQL databases better for my situation, as I make use of many tinyint columns which the default T4 maps to byte types. A quick edit to the T4 gave me the type I wanted instead for my application entities.


LINQ to SQL templates for T4
http://l2st4.codeplex.com/

Templates replicating the functionality of the SQLMetal and the LINQ to SQL classes designer code-generators for both C# and VB.Net requiring just Visual Studio 2008.


Check out this podcast on T4 by Scott Hanselman talking with Kathleen Dollard.
http://www.hanselminutes.com/default.aspx?showID=170


I've used T4 to generate:

  • proxies (design time, for injecting/wrapping monitoring code/logging/... in a very specific exposed api).
  • interface generation for a one-on-one interface/class mapping
  • replace reflection code by "directly/real" calling code (maintenance advantage of reflection code, but performance of the actual code) for instance when allowing access to properties through an indexer, or something in that direction.
  • xml generation for a java project (couldn't find a T4-like solution for java, that is easily shared within a company, T4 is easy because it's build in and you can run it from command line)
  • generate enums from a master database (we generated them both for a delphi-code base and .Net code base)