SerializeEFTablesToString 2.0.5

dotnet add package SerializeEFTablesToString --version 2.0.5
                    
NuGet\Install-Package SerializeEFTablesToString -Version 2.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SerializeEFTablesToString" Version="2.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SerializeEFTablesToString" Version="2.0.5" />
                    
Directory.Packages.props
<PackageReference Include="SerializeEFTablesToString" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SerializeEFTablesToString --version 2.0.5
                    
#r "nuget: SerializeEFTablesToString, 2.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SerializeEFTablesToString&version=2.0.5
                    
Install SerializeEFTablesToString as a Cake Addin
#tool nuget:?package=SerializeEFTablesToString&version=2.0.5
                    
Install SerializeEFTablesToString as a Cake Tool

Takes an Entity Framework DBContext and Serialises the contents of all the tables specified in the List of strings to a string.

The utility Class can be used as follows:

string parameterString= $"Customers," +                    // Outputs all columns for all records in the Customer Table
                       $"Customers[]" +                   // same as above
                       $"Orders[OrderId;OrderQuantity]" + // outputs only the OrderId and
                                                          // OrderQuantity from all records in the Orders table
                       $"Payments[!PaymentId;Date]";      // Outputs columns  EXCEPT PaymentId and Date from the Payments Table



SomeDbContext context = new SomeDbContext();
Formatter formatter = new Formatter();
String formattedOutputString = formatter.FormatEntities(context, parameterString);

The output string will have newline delimited lines as follows:

Customers
| CustomerId | Name      | DateOfBirth |
| 1          | Jon Doe   | 1982-03-12  |
| 2          | Eric Hand | 1966-04-15  |

Customers[]
| CustomerId | Name      | DateOfBirth |
| 1          | Jon Doe   | 1982-03-12  |
| 2          | Eric Hand | 1966-04-15  |

Orders[OrderId;OrderQuantity]
| OrderId | Quantity |
| 456     | 78       |
| 6578    | 65       |


Payments[!PaymentId;Date]
| PaymentAmount |
| 23.56         |
| 45.89         |

This last example assumes there were three columns ion the table two of which were excluded.

Note these are TABLE names not the Entity names as DbContext.Database.SqlQuery is used.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.5 1,582 6/5/2016
2.0.4 1,166 6/5/2016
2.0.3 1,185 5/24/2016
2.0.2 1,158 5/24/2016
2.0.1 1,145 5/9/2016
2.0.0 1,700 5/5/2016
1.0.2 1,154 4/17/2016
1.0.1 1,148 4/17/2016
1.0.0 1,163 4/17/2016

Updated to allow columns to be eother specified or excluded

Added where predicate