Skip to content

Commit 5839bc3

Browse files
committed
add readme
1 parent bd47bcf commit 5839bc3

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

docs/readme.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Overview
2+
3+
.NET Core command-line (CLI) tool to generate Entity Framework Core model from an existing database.
4+
5+
## Features
6+
7+
- Entity Framework Core database first model generation
8+
- Safe regeneration via region replacement
9+
- Safe Renaming via mapping file parsing
10+
- Optionally generate read, create and update models from entity
11+
- Optionally generate validation and object mapper classes
12+
13+
## Documentation
14+
15+
Entity Framework Core Generator documentation is available via [Read the Docs](https://efg.loresoft.com)
16+
17+
## Initialize Command
18+
19+
The `initialize` command is used to create the configuration yaml file and optionally set the [connection string](https://efg.loresoft.com/en/latest/connectionString/). The configuration file has many options to configure the generated output. See the [configuration file](https://efg.loresoft.com/en/latest/configuration/) documentation for more details.
20+
21+
The following command will create an initial `generation.yaml` configuration file as well as setting a user secret to store the connection string.
22+
23+
```Shell
24+
efg initialize -c <ConnectionString>
25+
```
26+
27+
Replace `<ConnectionString>` with a valid database connection string.
28+
29+
When a `generation.yaml` configuration file exists, you can run `efg generate` in the same directory to generate the source using that configuration file.
30+
31+
## Generate Command
32+
33+
Entity Framework Core Generator (efg) creates source code files from a database schema. To generate the files with the `generation.yaml` configuration, run the following
34+
35+
```Shell
36+
efg generate
37+
```
38+
39+
## Regeneration
40+
41+
Entity Framework Core Generator supports safe regeneration via region replacement and source code parsing. A typical workflow for a project requires many database changes and updates. Being able to regenerate the entities and associated files is a huge time saver.
42+
43+
### Region Replacement
44+
45+
All the templates output a region on first generation. On future regeneration, only the regions are replaced. This keeps any other changes you've made to the source file.
46+
47+
### Source Parsing
48+
49+
In order to capture and preserve Entity, Property and DbContext renames, the `generate` command parses any existing mapping and DbContext class to capture how things are named. This allows you to use the full extend of Visual Studio's refactoring tools to rename things as you like. Then, when regenerating, those changes won't be lost.
50+
51+
## Database Providers
52+
53+
Entity Framework Core Generator supports the following databases.
54+
55+
- SQL Server
56+
- PostgreSQL
57+
- MySQL
58+
- Sqlite
59+
- Oracle
60+
61+
The provider can be set via command line or via the [configuration file](https://efg.loresoft.com/en/latest/configuration/).
62+
63+
## View Models
64+
65+
Entity Framework Core Generator supports generating [Read](https://efg.loresoft.com/en/latest/md/read/), [Create](https://efg.loresoft.com/en/latest/md/create/) and [Update](https://efg.loresoft.com/en/latest/md/update/) view models from an entity. Many projects rely on view models to shape data. The model templates can be used to quickly get the basic view models created. The model templates also support regeneration so any database change can easily be sync'd to the view models.

src/EntityFrameworkCore.Generator/EntityFrameworkCore.Generator.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="..\..\build\common.props" />
33

44
<PropertyGroup>
@@ -9,12 +9,23 @@
99
<NoWarn>1591,EF1001</NoWarn>
1010
</PropertyGroup>
1111

12+
<PropertyGroup>
13+
<PackageReadmeFile>readme.md</PackageReadmeFile>
14+
</PropertyGroup>
15+
1216
<ItemGroup>
1317
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.1.0" />
1418
<PackageReference Include="Serilog.Extensions.Hosting" Version="4.2.0" />
1519
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
1620
</ItemGroup>
1721

22+
<ItemGroup>
23+
<None Include=".\..\..\docs\readme.md">
24+
<Pack>True</Pack>
25+
<PackagePath></PackagePath>
26+
</None>
27+
</ItemGroup>
28+
1829
<ItemGroup>
1930
<ProjectReference Include="..\EntityFrameworkCore.Generator.Core\EntityFrameworkCore.Generator.Core.csproj" />
2031
</ItemGroup>

0 commit comments

Comments
 (0)