views:

457

answers:

2

From Can I build 2 or more dlls from C# project in Visual Studio 2008?, I have another idea to create only 1 big project. After that, I separate a project dll(that contains many classes.) into 1 dll per class by using post-build event to call Win app project(for separate a big dll). How to do this?

Moreover, I need to manage attached file in a big dll too.

Update I found some trick that could guide me to solve this problem by custom build? Moreover, I think I can create custom handler that generate dynamic assembly file by using separate module file & al.exe. But this feature is over my expect and unnessary(sourcecode is rarely changed).

Multi-file Assemblies: What and How

How to: Build a Multifile Assembly

POCO Custom Multifile Assembly and ReSharper

Thanks,

+6  A: 

The answer that you will get here is no different from the answer in the other question: put in a separate project for each separate dll.

What I want to ask you is what your understanding of the definition of a "class" is. One class per DLL probably means that you're not very familiar with how assemblies, namespaces, and classes work.

Tell us, what do you really want to be able to do? Because what you think you should be doing to solve that problem (e.g., creating one DLL per class) is not practical.

Update

Considering the context of your requirement (e.g., Silverlight web application), my conclusion is that splitting your classes to several DLLs will not result in a performance improvement in an ASP.NET web page because:

  • DLLs are only used by the server, they are not downloaded via HTTP to your browser
  • Once a DLL is loaded by a web application it won't load it again -- regardless of how many users are using your site at the same time. One DLL instance per server.
  • When you start your web application it will load all DLLs that it depended on to compile, whether or not you will use it.

So with your requirements, it's probably best NOT to use Silverlight for your application, considering the bandwidth limit. The avenues you can explore are:

  • Learning AJAX techniques, specifically JSON, (and probably not ASP.NET AJAX and its easy-to-misuse UpdatePanel)
  • Learning jQuery to find controls that will implement in JavaScript what you want to do using Silverlight
Jon Limjap
you might want to add a link to the related question
m_oLogin
In other words "You keep asking this question. I do not think it means what you think it means!" :)
JP Alioto
it's in his question. :)
Jon Limjap
From my old question, I can create a lot of project for solve this problem. But, It hard to manage a lot of project(100+) in 1 solution.
Soul_Master
But WHY do you need 1 class per DLL in the first place?
Jon Limjap
Because startup page can load all of page partially that user want to view. I think, It's the only one idea to match between first loading time and smart RIA.
Soul_Master
Soul_Master
+8  A: 

Just... why? Having lots of dlls can have a performance impact on app startup (due to "fusion"). It will also pretty-much immediately suffer from circular references, which is a bad thing.

Since .NET code (by default) gets JITted when first used, there isn't a huge amount of impact in having extra classes in a dll that don't get used in that application. They just sit there, quietly, being no bother to anyone.

The sheer management cost of having a dll per class will make deployment etc excruciating.

All in all, I can't think of a sensible reason to do this...

Marc Gravell
Because I want to create Silverlight application like webform(1 Silverlight usercontrol equals 1 webpage). So, I need to create 1 dll for 1 Silverlight usercontrol.
Soul_Master
I occasionally separate out large classes like the DAL to shorten build time of the BLL classes. But to do that for each class, you are right; no "sensible reason".
rizzle
It's true. For all in one place application, this idea is unnessary. But for server/client application, this idea is great, if it can be true(creating silverlight page almost equal creating web page).
Soul_Master