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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:11:02+00:00 2026-05-15T01:11:02+00:00

AGAIN: If you’re voting -1, please leave a comment explaining why. This post isn’t

  • 0

AGAIN: If you’re voting -1, please leave a comment explaining why. This post isn’t about whether or not you approve if this approach, but how to go about it.

Like many architects, I’ve developed coding standards through years of experience to which I expect my developers to adhere.

This is especially a problem with the crowd that believes that three or four years of experience makes you a senior-level developer.Approaching this as a training and code review issue has generated limited success.

So, I was thinking that it would be great to be able to add custom compile-time errors to the build process to more strictly enforce our in-house best practices and coding standards.

For instance, we use stored procedures for ALL database access, which provides procedure-level security, db encapsulation (table structure is hidden from the app), and other benefits. (Note: I am not interested in starting a debate about this.) Some developers prefer inline SQL or parametrized queries, and that’s fine – on their own time and own projects.

I’d like a way to add a compilation check that finds, say, anything that looks like

string sql = "insert into some_table (col1,col2) values (@col1, @col2);"

and generates an error or, in certain circumstances, a warning, with a message like

Inline SQL and parametrized queries are not permitted.

Or, if they use the var keyword

var x = new MyClass();

Variable definitions must be explicitly typed.

Do Visual Studio and MSBuild provide a way to add this functionality? I’m thinking that I could use a regular expression to find unacceptable code and generate the correct error, but I’m not sure what, from a performance standpoint, is the best way to to integrate this into the build process.

We could add a pre- or post-build step to run a custom EXE, but how can I return line- and file-specifc errors? Also, I’d like this to run after compilation of each file, rather than post-link.

Is a regex the best way to perform this type of pattern matching, or should I go crazy and run the code through a C# parser, which would allow node-level validation via the parse tree?

I’d appreciate suggestions and tales of prior experience.

Comments
Several respondents have pointed out that it’s possible to restrict the ability of a user to run anything but a stored proc through db permissions. However, we’re in the process of porting a 350k+ line application from ASP 3.0 to ASP.NET MVC, and the existing code base relies pretty heavily on concatenated SQL, whereas the new stuff all uses Enterprise Library. I guess I could add a separate web user account for the .NET code with more restrictive permissions.

  • 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-15T01:11:03+00:00Added an answer on May 15, 2026 at 1:11 am

    For coding standards I would look at writing custom rules for FxCop or StyleCop. I don’t think Regex would be a suitable tool for the job.

    For the specific case of requiring Stored Procedures – if you ensure the application doesn’t have permission to do anything else on the production database, everyone will soon fall in line.

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

Sidebar

Ask A Question

Stats

  • Questions 408k
  • Answers 408k
  • 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 Using the GRANT command. USE DBNAME; GRANT SELECT TO RoleName;… May 15, 2026 at 6:45 am
  • Editorial Team
    Editorial Team added an answer I think what you're looking for is the ParseChildren attribute.… May 15, 2026 at 6:45 am
  • Editorial Team
    Editorial Team added an answer Use negative assertion. (?!.*\S{10}) \S{10} matches a sequence of 10… May 15, 2026 at 6:44 am

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.