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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:16:30+00:00 2026-05-16T04:16:30+00:00

How can I store C# methods in a sql server instance to be loaded

  • 0

How can I store C# methods in a sql server instance to be loaded and run dynamically (at runtime) at a later date?

I am about to begin a production test project at work where I would like the appropriate test methods for the product to be loaded at runtime.

I have looked at Reflection.Emit DynamicMethod briefly but it is not serializable.

Any suggestions or alternative routes would be appreciated.

  • 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-16T04:16:31+00:00Added an answer on May 16, 2026 at 4:16 am

    Serialising classes does not serliase any code it just serialises data and the reloads that data into the properties of the class when it is deserialised. Any methods on the class are just the same as if you had just instantiated the class manually. Trying to serialise actual code to a database and then somehow compile it into a method from at run time is a pretty whacky and exotic thing to do and i am strugling to understand how it would be useful in the context of testing. If you really really want to store the source code in the database you would be better off storing it as text, retreiving it into a text file then programtically compiling it. However this is what source control and build systems are for such as Subversion and Nant, so you would arguably be reinventing the wheel.

    Further to your last comment i think a good pattern for what you require would be dependency injection. You create an interface (e.g. ITester) that defines the contract for a test, a simple one would be a test method that returns a bool for pass and fail. You write your testing program as normal, but your test method takes a class that implements the ITest interface. The class that implements the ITester interface is reponsible for the specific test implementation and actually carries out the test. THe rest of the system does not care what the test is or how it is carried out, it simply runs a test method that returns true or false.

    That way all you have to do to create a new test implementation is create a new class that implements ITester. If you need to change a test implementation you just alter the particular class and redeploy. If you compile each tester class into it’s own DLL, you can store these as binary data in the database. You can then extract them from the database and load them dynamically using System.Reflection.Assembly.Load. Note, this is not serialisation, you are storing the binary assembly file in the datbase.

    What you end up with is a system that decides what test it needs to run, queries the database for the relevent DLL file that can run the test code, then dynamically loads and executes the DLL at run time.

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

Sidebar

Ask A Question

Stats

  • Questions 497k
  • Answers 497k
  • 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 Why are you making your application modify its own files?… May 16, 2026 at 11:56 am
  • Editorial Team
    Editorial Team added an answer Replace: DocumentRoot /var/empty with: DocumentRoot /home/zach/projects/python/myproject/wordpress Remove: Alias / /home/zach/projects/python/myproject/wordpress/… May 16, 2026 at 11:56 am
  • Editorial Team
    Editorial Team added an answer The problem, I think, is the initial command (or what… May 16, 2026 at 11:56 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

Related Questions

I created a C#.net app that uses dates from a SQL Server 2008 database
I have a SQL Server 2008 database utilizing Filestreaming and all works fine and
I am using ms sql server 2005 and I want to do a mass
I have a three tier system, SQL Server backend, hand written data access layer,
Let's say we have a field that can be in more than one type,
I created a Class Library named Repository and which includes LINQ To SQL file
I am writing the necessary business logic in C# methods by using class library
I am currently building a web application for my work and you can add
Arrrg!I am running into what i feel is a dumb issue with a simple
In a .NET project, say you have a configuration setting - like a connection

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.