C# code in DB?

D

digory

Hi all

Is it possible to place parts of a C# application (code + GUI) in a
database like Oracle? The application should be a "thin client", i.e.
it does little else than getting code from the DB and executing it.
How do I do it? (Please no details, I am only evaluating the
possibilities, I'm not a C# crack yet.)

Thanks for your replies!
Peter
 
L

Lasse Vågsæther Karlsen

digory said:
Hi all

Is it possible to place parts of a C# application (code + GUI) in a
database like Oracle? The application should be a "thin client", i.e.
it does little else than getting code from the DB and executing it.
How do I do it? (Please no details, I am only evaluating the
possibilities, I'm not a C# crack yet.)

Thanks for your replies!
Peter

Since you can load assemblies from a byte array in memory or memory
stream, it's of course possible to do these things, provided you do them
right.

For instance, you might need to hook into the resolution mechanism of
the app domain to handle referenced assemblies, ie. you load assembly A
and ask for an object from it, which needs assembly B, that also needs
to be loaded from the database.

So yes, it's doable.
 
J

Jon Skeet [C# MVP]

digory said:
Is it possible to place parts of a C# application (code + GUI) in a
database like Oracle? The application should be a "thin client", i.e.
it does little else than getting code from the DB and executing it.
How do I do it? (Please no details, I am only evaluating the
possibilities, I'm not a C# crack yet.)

You can certainly put assemblies into databases, just as byte arrays
(just like you'd put pictures in, basically). You might need to think
carefully about the security involved, however - executing arbitrary
code is somewhat dangerous. You might want to use something like
public/private key signatures to make sure that the code you're going
to execute really is trustworthy.
 
A

Arne Vajhøj

digory said:
Is it possible to place parts of a C# application (code + GUI) in a
database like Oracle? The application should be a "thin client", i.e.
it does little else than getting code from the DB and executing it.
How do I do it? (Please no details, I am only evaluating the
possibilities, I'm not a C# crack yet.)

It is possible.

But I do not like the approach.

The client app would be talking directly to the database
server. Database servers are usually less hardened than
web/app servers.

I do not see any benefits of having the code in the database.

It will require a lot of plumbing to get it working.

Arne
 
D

digory

Thanks for your replies. Security is not a problem. The client app
talks to some middleware with a secure connection, the middleware is
in the same network as the database. The code that will be executed is
not arbitrary as nobody has access to the database except us. (There
would be a lot of more harmful things somebody could do if he had
access to the database.)

The reason why we would like to put C# code in the database is the
following: Our clients are hospitals, there are hundreds of computers.
If our application had to be reinstalled everytime we make a new
release, somebody had to go to all these computers, run the setup
application, etc., which is just not practical. Instead, our
application is designed as a thin client that gets code from the
server. Because the concept of the thin client is simple and robust,
it requires little modification over time, so new releases of the thin
client are rare. The actual code is in the DB, we can upload new
releases or even minor bugfixes at any time.
 
P

Pete Kane

digory said:
Hi all

Is it possible to place parts of a C# application (code + GUI) in a
database like Oracle? The application should be a "thin client", i.e.
it does little else than getting code from the DB and executing it.
How do I do it? (Please no details, I am only evaluating the
possibilities, I'm not a C# crack yet.)

Thanks for your replies!
Peter

Hi there, you could place your assemblies (dlls) on a server and load
them dynamically from your thin client - I use this method in several of
my apps
 
J

Jeff Winn

If you're worried about the deployment process just write a web application
instead of a client app. I would avoid doing what you're doing at all costs,
even if it means more development time.
 
B

Ben Voigt [C++ MVP]

digory said:
Thanks for your replies. Security is not a problem. The client app
talks to some middleware with a secure connection, the middleware is
in the same network as the database. The code that will be executed is
not arbitrary as nobody has access to the database except us. (There
would be a lot of more harmful things somebody could do if he had
access to the database.)

The reason why we would like to put C# code in the database is the
following: Our clients are hospitals, there are hundreds of computers.
If our application had to be reinstalled everytime we make a new
release, somebody had to go to all these computers, run the setup
application, etc., which is just not practical. Instead, our
application is designed as a thin client that gets code from the
server. Because the concept of the thin client is simple and robust,
it requires little modification over time, so new releases of the thin
client are rare. The actual code is in the DB, we can upload new
releases or even minor bugfixes at any time.

You might want to reconsider frequent updates in a hospital or any other
healthcare environment. The cost of actually installing the software, even
if it has to be done by hand, would be miniscule compared to the
verfication/validation testing for safety, efficacy, and reliability.

Also, you could look at various deployment options which cache the code
locally, so losing a connection to the update server doesn't become a
catastrophe.
 
A

Arne Vajhøj

digory said:
Thanks for your replies. Security is not a problem. The client app
talks to some middleware with a secure connection, the middleware is
in the same network as the database. The code that will be executed is
not arbitrary as nobody has access to the database except us. (There
would be a lot of more harmful things somebody could do if he had
access to the database.)

The reason why we would like to put C# code in the database is the
following: Our clients are hospitals, there are hundreds of computers.
If our application had to be reinstalled everytime we make a new
release, somebody had to go to all these computers, run the setup
application, etc., which is just not practical. Instead, our
application is designed as a thin client that gets code from the
server. Because the concept of the thin client is simple and robust,
it requires little modification over time, so new releases of the thin
client are rare. The actual code is in the DB, we can upload new
releases or even minor bugfixes at any time.

I can still not see any reason to have in the database compared
to in the file system.

Have you evaluated click once as a possibility ?

Furthermore .NET is by default XCOPY deployable, so
they can very easily be upgraded.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top