3

I recently took over a web project. The data layer is one auto generated class file separated in an independent project. I have no idea what tool they used to generate the class file.

The problem: The file is a series of partial classes (5000+ class) summed to over 7 million line of code. (DLL file generated is around 70Mb)

Adding to it some custom partial classes in 2 files.

The project does not open in VS2013 or 2015 because VS go out of memory and crash after several minutes. They are using VS 2012 now. Building the project take around 10-20 minutes on an I7 PC with 6G of RAM.

Solution: 1- I was able to create a simple code that separated the partial classes in separated files. So now I have a project with 5000+ file and that is making it a little bit more readable and manageable in VS.

Still the main class is around 80K line of code.

2- I know that 70% of the generated code is not used in the web project so I tried to find a automated way to delete unused code. Unfortunately no tool can handle the big mess I have.

3- Finally I was thinking of separating the auto generated classes in an independent project and pull it out of the solution so other project can just reference the DLL. But my plan failed as the 2 custom files in the data layer project are regularly updated and are also partial classes.

I would appreciate any idea that can solve any of my problems.

Thanks,

Albert_S
  • 599
  • 1
  • 4
  • 5
  • 1
    Sorry for off-topic question, but what kind of project uses 5000+ classes? – Robert Goldwein Jan 24 '16 at 10:39
  • Man I asked myself the same thing. But the product is working and generating money. My Job is to fix the mess. I think the generated tool created classes for every possible call to DB. – Albert_S Jan 24 '16 at 10:44
  • Are you using resharper? That can show you classes that are never called... – Jens Meinecke Jan 24 '16 at 11:17
  • @Übercoder VS13 (not community edition) is showing it too. – bot_insane Jan 24 '16 at 11:21
  • Could you drop some simple chart so I could better understand the dependencies ? – Midi Jan 24 '16 at 11:22
  • Have you tried to pass your class to Roslyn ? Does it handle it ? If yes, I think, we can get all methods in this class, then find methods that have no reference and delete them. Quick search in google shows that all this is supported by Roslyn(getting all methods, methods reference count) What you think about it? – bot_insane Jan 24 '16 at 11:30
  • 1
    Resharper can't handle it. It will crash. I will try the other tools suggested but I do not think it will work. – Albert_S Jan 24 '16 at 11:45
  • If it is autogenerated, there should be some autogenerated comments in the generated file, that indicate the used tool. Have you already checked the big candidate tools like LLBLGen? – grek40 Jan 24 '16 at 12:13
  • Off topic, but I cannot resist to ask... are you required to handle this project *alone*?? – Ian Jan 24 '16 at 14:39

0 Answers0