-
Notifications
You must be signed in to change notification settings - Fork 5
ObjectAsSourceCodeDebuggerVisualizer
The Object-as-Source-Code Debugger Visualizer is a Debugger Visualizer that displays C# source code that will generate the .Net object chosen in the debugger. In other words: It will serialize the object as C# source text. Its main purpose is to generate an object graph for input into a unit test. The specific use case it was made for is testing code that processed the results of aLLBLGen Pro LINQ query. It is essentially a Debugger Visualizer wrapper around a modified version of https://github.com/jefflomax/csharp-object-to-object-literal
Download x or y, you will be presented with this install screen:
You may need to run it as admin to install for all users. As well as this Debugger Visualizer for Visual Studio the source code generation functionality is exposed in theGridDataEditor and hence available in any tools that uses it such as theLLBLGen Pro LINQPad Driver and LLBLGen Entity Browser
- https://github.com/jefflomax/csharp-object-to-object-literal emit a C# object literal constructor for a NHibernate object (graph) in memory. (Which this is based on).
- CarbonCopy in the Visual Studio Gallery for VS2013 Sourcehttp://jmethot79.github.io/CarbonCopy/ Currently VB.Net only.
- Object Exporter in the Visual Studio Gallery
At the time I wrote this tool, late 2014, none of these other tools did quite what I needed.
The class is here CSharpSerializer.cs, the method to call is CSharpSerializer.SerializeToCSharp, unit tests are hereCSharpSerializerTests.cs
Example calling from LINQPad using the LLBLGen Pro LINQPad Driver against the Northwind DB.
Customer.PrefetchOrders().ToEntityCollection2().SerializeToCSharp(OutputFormat.LinqpadProgram,"Fields,EntityFactoryToUse,Picture")
which creates code like this:
// Object Literal // Globally Excluded Properties: // Fields,EntityFactoryToUse,Picture void Main() { ResultContainer.Result().Dump(); } public static class ResultContainer { public static object Result() { var entityCollection9082615 = new EntityCollection { new CustomerEntity { Address = "Obere Str. 57", City = "Berlin",
…
which is runnable in LINQPad