SSchnitzler
SSchnitzler

Reputation: 165

Linq2Sql Buildtime takes ages

I am using Linq2Sql to access my database which is fairly large. (67 tables) It's quite a pain in the butt to work with currently because it takes ages for the "MSLinqToSQLGenerator" to generate it's classes and finally finish compiling.

Are there any ways to speed up that process? Like, is it possible to cache its generated output as I'm rarely touching the databasestructure?

Thank you for reading.

Upvotes: 1

Views: 64

Answers (1)

Sampath
Sampath

Reputation: 65870

Moving your model to a separate assembly.

When your model is included directly in your application's project and you generate views through a pre-build event or a T4 template, view generation and validation will take place whenever the project is rebuilt, even if the model wasn't changed.

If you move the model to a separate assembly and reference it from your application's project, you can make other changes to your application without needing to rebuild the project containing the model.

Note: when moving your model to separate assemblies remember to copy the connection strings for the model into the application configuration file of the client project.

For more Information Check Performance Considerations for Entity Framework

Upvotes: 2

Related Questions