Suggestion: Export LINQPad generated context (source and/or assemblies)

It would be nice to be able to export the contexts generated by LINQPad. That way if we wanted to make some tweaks, we would be able to do so and then even add the modified context back, a way of scaffolding. Could be a useful learning tool for learning how one might build a data context from scratch.


  • Are you referring to the automatically generated LINQ-to-SQL contexts? This relies on an internal forked version of L2S, so it wouldn't compile outside its context.

    In terms of making tweaks, one of the difficulties with editing the source is that there's no nice way to merge the tweaked source with any new objects that you might want to add after you create new tables, views or SPs. It would also break a query's portability, unless the entire tweaked data context was stored inside every query.
  • Maybe not the same exact version that is used by LINQPad but a version that could later be imported by LINQPad ("Use a typed data context from your own assembly").

    I'm building out a set of EF Core 3.0 contexts with some specific tables and properties omitted and/or modified. I could use an external code generator or script one out to do a lot of this, but I would love it if LINQPad could be that code generator.
  • Ah, so you want to use LINQPad's EF Core scaffolder instead of the one that's built into EF Core?

    LINQPad's scaffolder is more robust, but it doesn't emit the code required to round-trip and recreate the database. This includes indexes, default values, constraints, etc. I'd probably this logged as a bug report. Is there any reason that the EF Core scaffolder wouldn't suffice?
  • The scaffolder would probably work fine. I'm just trying to set up an environment where everything could be done within LINQPad. For those who are adverse to using additional tools and wants an all-in-one solution, or close to it.

Sign In or Register to comment.