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 205001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:31:03+00:00 2026-05-11T17:31:03+00:00

Is it possible to extend the SubSonic generator without modifying it’s code? I would

  • 0

Is it possible to extend the SubSonic generator without modifying it’s code?
I would like to add my own custom methods that i can use inside the templates. Somthing similair like the Utility.GetVariableType method.

  • 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-11T17:31:04+00:00Added an answer on May 11, 2026 at 5:31 pm

    I’ve found the solution for my own problem :).
    I can now extend SubSonic with functionality i need in the templates without needing to rebuild or change any of the SubSonic code itself.
    It works for what i wanted to do and i think it can be usefull for others as well so here it is:

    1. Create a new class library SubSonicHelper. Mine has a class looking like this:

      using System;
      using System.Collections.Generic;
      using System.Text;
      
      namespace Helpers.SubSonic
      {
          public class GeneratorHelper
          {
              public bool IsColumnAllowed(string columnName)
              {
                  return columnName.Length == 1 ||
                         (columnName.Length > 1 && 
                         (!(columnName[0].ToString().Equals("_") && 
                         columnName[columnName.Length - 1].ToString().Equals("_"))))
              }
          }
      }
      
    2. Build the assembly and copy SubSonicHelper.dll to your subsonic project.
    3. Setup your SubSonic project to use your own templates using the templateDirectory parameter.
    4. Edit your own templates and at the following after the const bool showGenerationInfo = false;

      System.Reflection.Assembly a = System.Reflection.Assembly.LoadFile(
          System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "SubSonicHelper.dll"));
      object instance = a.CreateInstance("Helpers.SubSonic.GeneratorHelper");
      Type type = instance.GetType();
      

    After this you have an instance of the GeneratorHelper that you can use inside the template. For accessing the methods you need to do the following:

    1. Create an array of objects for the parameters of the method you want to use. I have the columnName parameter which i set to col.propertyName. This is inside the foreach (TableSchema.TableColumn col in cols) loop in the Update method.
    2. Call the method you want to use with the object array as argument.
    3. Check the result object to see the result of the method.

      object[] arg = new object[]{col.PropertyName};
      object isColumnAllowedResult = type.InvokeMember("IsColumnAllowed", System.Reflection.BindingFlags.Default | System.Reflection.BindingFlags.InvokeMethod, null, instance, arg);
      if (Convert.ToBoolean(isColumnAllowedResult))
      

    That’s it! Now i can extend the SubSonicHelper class with other methods i want to use inside the template.

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

Sidebar

Ask A Question

Stats

  • Questions 147k
  • Answers 147k
  • 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 I don't know of a stand-alone package, but I know… May 12, 2026 at 9:09 am
  • Editorial Team
    Editorial Team added an answer can you shut off the stopwatch before you exit? May 12, 2026 at 9:09 am
  • Editorial Team
    Editorial Team added an answer Here's the problem: because you have this: line = reader.ReadLine();… May 12, 2026 at 9:09 am

Related Questions

Is it possible to extend the SubSonic generator without modifying it's code? I would
Is it possible to extend the interface builder's attribute inspector with additional attributes for
Is it possible to extend LINQ-to-SQL entity-classes with constructor-methods and in the same go;
Is it possible to implement the Visitor Pattern respecting the Open/Closed Principle , but
Is it possible to decorate/extend the python standard logging system, so that when a

Trending Tags

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

Top Members

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.