skeleton-codegen
所属分类:自动编程
开发工具:C#
文件大小:282KB
下载次数:0
上传日期:2023-06-01 07:38:14
上 传 者:
sh-1993
说明: 一个面向.NET的以数据库为中心的代码生成器
(A Database-centric code generator for .NET)
文件列表:
Skeleton.Console (0, 2023-07-08)
Skeleton.Console\GeneratedFileCleaner.cs (5430, 2023-07-08)
Skeleton.Console\Generator.cs (13180, 2023-07-08)
Skeleton.Console\Program.cs (11299, 2023-07-08)
Skeleton.Console\Properties (0, 2023-07-08)
Skeleton.Console\Properties\launchSettings.json (384, 2023-07-08)
Skeleton.Console\Skeleton.Console.csproj (1927, 2023-07-08)
Skeleton.Flutter (0, 2023-07-08)
Skeleton.Flutter\ApiClient (0, 2023-07-08)
Skeleton.Flutter\ApiClient\api.dart.handlebars (3336, 2023-07-08)
Skeleton.Flutter\ApiClient\model.dart.handlebars (577, 2023-07-08)
Skeleton.Flutter\ApiClient\result.dart.handlebars (1068, 2023-07-08)
Skeleton.Flutter\Generator.cs (4467, 2023-07-08)
Skeleton.Flutter\NewProject (0, 2023-07-08)
Skeleton.Flutter\NewProject\ColorModel.cs (544, 2023-07-08)
Skeleton.Flutter\NewProject\main.dart.colorfragment.handlebars (649, 2023-07-08)
Skeleton.Flutter\Skeleton.Flutter.csproj (1251, 2023-07-08)
Skeleton.Model.Tests (0, 2023-07-08)
Skeleton.Model.Tests\NamingConventions (0, 2023-07-08)
Skeleton.Model.Tests\NamingConventions\PascalCaseNameingConventionTests.cs (816, 2023-07-08)
Skeleton.Model.Tests\Skeleton.Model.Tests.csproj (565, 2023-07-08)
Skeleton.Model (0, 2023-07-08)
Skeleton.Model\CodeFile.cs (307, 2023-07-08)
Skeleton.Model\Constraint.cs (312, 2023-07-08)
Skeleton.Model\Domain.cs (7101, 2023-07-08)
Skeleton.Model\Field.cs (6435, 2023-07-08)
Skeleton.Model\IPseudoField.cs (855, 2023-07-08)
Skeleton.Model\ITypeProvider.cs (1608, 2023-07-08)
Skeleton.Model\Name.cs (1449, 2023-07-08)
Skeleton.Model\NamingConventions (0, 2023-07-08)
Skeleton.Model\NamingConventions\INamingConvention.cs (872, 2023-07-08)
Skeleton.Model\NamingConventions\NamingConventionBase.cs (1790, 2023-07-08)
Skeleton.Model\NamingConventions\NamingConventionSettings.cs (632, 2023-07-08)
Skeleton.Model\NamingConventions\PascalCaseNamingConvention.cs (2960, 2023-07-08)
Skeleton.Model\NamingConventions\SnakeCaseNamingConvention.cs (1736, 2023-07-08)
Skeleton.Model\Operation.cs (4670, 2023-07-08)
Skeleton.Model\Operations (0, 2023-07-08)
Skeleton.Model\Operations\IOperationPrototype.cs (575, 2023-07-08)
... ...
# Skeleton #
Skeleton is a database-centric command-line code generation tool written in .net core.
> When woodworkers are faced with the task of producing the same thing over and over, they cheat. They build themselves a jig or template. If they get the jig right once, they can reproduce a piece of work time after time. The jig takes away complexity and reduces the chances of making mistakes, leaving the craftsman free to concentrate on quality.
_David Thomas and Andy Hunt - The Pragmatic Programmer_
## Main Ideas ##
- Use all the schema information from a relational database
- Generated code should look as nice as human-written code.
- You should be able to re-generate your code multiple times.
- You should be able to opt out of re-generating particular files.
- Use sane conventions for naming and structure over configuration.
## What Does Skeleton Generate ##
Skeleton attempts to generate a 'full stack' of an application once the database schema is defined. Generating a full application is usually infeasible because some parts of an application will be particular to that application. Skeleton tries to create a good base to customise from. It generates:
- database functions and types for function results
- database policies for controlling entity access
- C# 'repository' wrappers for database functions
- C# controllers that call through to repositories
- typescript client API for calling C# controllers
- React components for displaying, editing, and deleting entities.
- In-memory repositories to make tests easier to set up
## Databases ##
Relational databases provide a rich source of machine-readable information about the entities and their relationships in a domain. Skeleton uses this, with some augmentation via attributes, to generate the basics of an application. Skeleton is currently very postgres-centric, but also works with SQL Server (see table below for comparison).
## Pre-Requisites ##
Skeleton and the apps it generates depend on the following:
1. Your database of choice (Postgres or SQL Server) - if you don't have it installed a docker image is probably the easiest way to get started.
2. The .NET SDK
3. Node (for building react front-ends)
4. Git
## Getting Started ##
To test out Skeleton using the Survey sample application perform the following steps.
1. Install the pre-requisites mentioned above
1. Clone the Skeleton repository
1. Build the Skeleton solution
1. Clone the template project base [TODO - provide location]
1. Run the Survey app .sql file `./Skeleton.Tests/scripts/survey/001 - survey.sql`. Note down the password that is generated for the user survey_web_user in the output. You will use this later in step 8.
1. Create a configuration file called `survey.config.json` for the survey application in the build output directory of the Skeleton.console project (probably `./Skeleton.Console/bin/debug/netcoreapp3.1/`) . You will probably want to customize the "root" location
```
{
"root": "c:\\path\\to\\your\\app",
"name": "SurveyApp",
"data-dir": ".\\Data\\Database\\",
"ConnectionStrings": {
"application-db": "Server=127.0.0.1;Port=5432;Database=survey;User Id=postgres;Password=secret_password;"
}
}
```
7. Run the Skeleton console by navigating to the Skeleton.Console app build output directory and running `skeleton-codegen -u -react -c survey -n --tmplt
--brand-color #5FD***0`
1. Open the root location specified in the config file you created in step 6 above, and open the `appsettings.json`. Fix up the connection string. The script `001 - survey.sql` creates a user called survey_web_user, and generates a random password for the user which it prints to the output. Assuming you're connecting to a local postgres db running on the standard port the connection string would be `"Server=127.0.0.1;Port=5432;Database=survey;User Id=survey_web_user;Password=
近期下载者:
相关文件:
收藏者: