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

  • SEARCH
  • Home
  • 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 877643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:38:36+00:00 2026-05-15T11:38:36+00:00

I’ve run into a problem when using SubSonic 3(.0.0.3) ActiveRecord with MySQL. Since MySQL

  • 0

I’ve run into a problem when using SubSonic 3(.0.0.3) ActiveRecord with MySQL.

Since MySQL doesn’t allow you to use uppercase letters in table or column names (or rather disregards it if you do) I decided to separate words using underscores, e.g. entity_id, and then use the CleanUp() method to add title casing and remove the underscores.
A friend wrote a ToTitleCase(string s) method that looks like this:

string ToTitleCase(string s)
{
    CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
    TextInfo textInfo = cultureInfo.TextInfo;
    return textInfo.ToTitleCase(s);
}

And the CleanUp() method looks like this:

string CleanUp(string tableName){
    string result=tableName;

    //strip blanks
    result=result.Replace(" ","");

    //put your logic here...
    result = ToTitleCase(result);
    result = result.Replace("_", "");

    return result;
}

If I then do:

var entity = Entity.All().Where(e => e.EntityName.Contains("John"));

I get a NotSupportedException, with the message “The member ‘EntityName’ is not supported.”

If I remove

result = result.Replace("_", "");

Everything works just fine, only I get properties looking like Entity_Id which is not quite what I want.

If anyone knows why this happen, I would love to hear it. If it’s possible to fix, even better! It’s no showstopper but it’s slightly annoying.

  • 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-15T11:38:36+00:00Added an answer on May 15, 2026 at 11:38 am

    For many many months this was an issue for me and I just avoided underscores when working with SubSonic on any supported DB. Until yesterday when I had to support a legacy project that had underscores in its SQL Server database.

    You’ll have to fix it within the source code of SubSonic.Core (file: SubSonic.Core\Schema\DatabaseTable.cs):

    Find this method:

    public IColumn GetColumnByPropertyName(string PropertyName)
    {
        return Columns.SingleOrDefault(x => x.Name.Equals(PropertyName, StringComparison.InvariantCultureIgnoreCase));
    }
    

    And change it to:

    public IColumn GetColumnByPropertyName(string PropertyName)
    {
        return Columns.SingleOrDefault(x => x.PropertyName.Equals(PropertyName, StringComparison.InvariantCultureIgnoreCase));
    }
    

    Next you’ll have to modify your Structs.tt:

    Find this near the top:

    Columns.Add(new DatabaseColumn("<#=col.Name#>", this)
    {
        IsPrimaryKey = <#=col.IsPK.ToString().ToLower()#>,
        DataType = DbType.<#=col.DbType.ToString()#>,
        IsNullable = <#=col.IsNullable.ToString().ToLower()#>,
        AutoIncrement = <#=col.AutoIncrement.ToString().ToLower()#>,
        IsForeignKey = <#=col.IsForeignKey.ToString().ToLower()#>,
        MaxLength = <#=col.MaxLength#>
    });
    

    And add this line:

        PropertyName = "<#=col.CleanName#>",
    

    So that it becomes:

    Columns.Add(new DatabaseColumn("<#=col.Name#>", this)
    {
        PropertyName = "<#=col.CleanName#>",
        IsPrimaryKey = <#=col.IsPK.ToString().ToLower()#>,
        DataType = DbType.<#=col.DbType.ToString()#>,
        IsNullable = <#=col.IsNullable.ToString().ToLower()#>,
        AutoIncrement = <#=col.AutoIncrement.ToString().ToLower()#>,
        IsForeignKey = <#=col.IsForeignKey.ToString().ToLower()#>,
        MaxLength = <#=col.MaxLength#>
    });
    

    The problem is that once you cleaned up the column names, SubSonic tries the find the valid columns in your query by matching your SubSonic generated property names against the database’s original column names.

    These changes will make sure that SubSonic be matching them against the cleaned property name.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well I figured out how to Invoke some script from… May 15, 2026 at 4:55 pm
  • Editorial Team
    Editorial Team added an answer document.location = "signin"; This will refresh the page. There's no… May 15, 2026 at 4:55 pm
  • Editorial Team
    Editorial Team added an answer yes, there is. Using jQuery: $(window).bind('focusout', function(){ console.log('bye bye'); });… May 15, 2026 at 4:55 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

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.