Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / October 2003

Tip: Looking for answers? Try searching our database.

Compiling dynamic data at design time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Enrico - 09 Oct 2003 16:54 GMT
I have a complicated problem involving dynamic data that
needs to be read at design time.

Here's the situation:

I have a database table called Categories (fields:
categoryID, description).  At design time, I want to be
able to select all records from another table where
categories.description = 'Animal'.  However, using the
description in the code is really lame and using the
categoryID is not possible because it's not known at
design time.

The idea that I have is to somehow read the data and
compile it into an enumeration class at design time.

The problem:

Compiling the data means that we get a static snap-shot of
it.  This is not practical because if the data change, we
need to manually recompile it and I don't know how to do
it easily at runtime.  Even if I do, I still don't know
how to recompile it automatically at design time.

My friend has an idea of using a trigger on the table to
create an MSIL of the class when the data changes.  My
problem with that is that we have to hard code the
webserver path in the trigger. We can't do this with
clustering/failover.

Anyone with suggestions?  Thank you so much for even
thinking about it.

Sincerely,

Enrico
Peter Koen - 09 Oct 2003 22:07 GMT
> Anyone with suggestions?  Thank you so much for even
> thinking about it.
>
> Sincerely,
>
> Enrico

What about using either CodeDOM or Reflection.Emit to create the
Assembly/Classes/Enums at runtime.

like this:
1) Fetch data from database
2) take a template and insert with CodeDOM all necessary objects
3) compile to a file or bytearray
4) do a dynamic load with Assembly.Load(....)

or this:
once: build a template class
1) Fetch data from database
2) use System.Reflection.Emit to add additional fields, properties and
methods into your template class

Signature

best regards

Peter Koen
-----------------------------------
MCAD, CAI/R, CAI/S, CASE/RS, CAT/RS
http://www.kema.at


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.