How to create assembly

  • Thread starter Thread starter Andrus
  • Start date Start date
A

Andrus

I have 120 .cs files in single directory containig POCO s like:

Entity1.cs:

namespace Model {
public class Entity1 {
string property1;

public virtual string Property1 {
get { return property1; }
set { property1 = value; }
}
}
}

Entity2.cs:

namespace Model {
public class Entity2 {
string property2;

public virtual string Property2 {
get { return property2; }
set { property2 = value; }
}
}
}

I need to generate Model.dll assembly from those files from my application.
Where to find sample code which compiles cs files and creates dll file ?

Andrus.
 
Thank you.

I need to create this dynamiccaly from my application.

Visual C# Express may be not installed so my application cannot use it.

I think there must be some classes in .NET which allow to create assembly
file.

Andrus.
 
Sorry, it looks like I totally missed the context of your question.

So it sounds as if you want to distribute source code and have your program
compile the code on the end user's computer, potentially on computers without
a csharp compiler installed. Do I understand your approach?

What is the reason for recompiling the code? There may be other ways to
solve your requirement if you elaborate the requirements to the group.
 
Thank you.

I'm planning to create WinForms ERP application which uses Castle
ActiveRecord Entity classes for data access layer.

I created code generator which creates .cs files, separate file for every
database table.

My appl users can add fields to database tables after application is
deployed to create new fields for customer, invoice tables etc.

So I need to re-generate data-access layer if end user adds custom columns
to tables.
For this I need to create assembly from .cs files at runtime.

I'm planning to create class hierarchy containing 5 classes in 5 dll files
from which 2 (3 entity classes and 5 custom business logic) can be compiled
dynamically at customer sites:

1 ActiveRecordValidationBase<T> - Castle.ActiveRecord.dll class. Base class
for classes 2-5
2 ModelGenericBase<T> - ModelGenericBase.dll - common logic. Static dll,
deployed with application.
3 Entity classes: CustomerEntity, InvoiceEntity etc. -
ModelEntity.dll - this dll is generated dynamically from database tables.
4 Business logic - Business.dll - business logic, uses entity
classes. Static dll, deployed with application.
5 Customer, Invoice etc. class - ModelCustom.dll - contains custom
logic. Generated dynamically if on-site customization is used.

Andrus.
 
Ok, now I see what you are after. This is completely out of my domain, but I
suspect others have tackled something similar. You might repost what you
just described to the group under a subject of something similar to "dynamic
client site code for user modified db schemas". (That is just my guess at a
subject). The customers that our group deal with are fairly squeemish about
adding a row to a table, let alone adding columns, stored procedures, etc.
Good luck! It sounds like an interesting concept!
 
ModelBuilder said:
Ok, now I see what you are after. This is completely out of my domain,
but I
suspect others have tackled something similar. You might repost what you
just described to the group under a subject of something similar to
"dynamic
client site code for user modified db schemas". (That is just my guess at
a
subject). The customers that our group deal with are fairly squeemish
about
adding a row to a table, let alone adding columns, stored procedures, etc.
Good luck! It sounds like an interesting concept!

Thank you.
Should I re-post this in the same group ?

Andrus.
 
I looked all newsgroup names in Microsoft news server containing "database"
in its name but havent found appropriate.

What database newsgroup you mean ?

Andrus.
 
This group in web has only appox 20 thread in this year.
This group in news server has only 10 threads in this year.

So both news and web groups are dead.

Andrus.
 

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

Back
Top