https://github.com/trackableentities/observableentities.core.templates.typescript
Handlebars templates for EF Core scaffolding to generate client-side TypeScript observable entities.
https://github.com/trackableentities/observableentities.core.templates.typescript
Last synced: 7 months ago
JSON representation
Handlebars templates for EF Core scaffolding to generate client-side TypeScript observable entities.
- Host: GitHub
- URL: https://github.com/trackableentities/observableentities.core.templates.typescript
- Owner: TrackableEntities
- License: mit
- Created: 2019-06-25T21:52:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-25T22:03:09.000Z (over 6 years ago)
- Last Synced: 2025-02-04T11:43:32.718Z (9 months ago)
- Language: HTML
- Size: 1.68 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
Awesome Lists containing this project
README
# Observable Entities for EF Core TypeScript Handlebars Templates
Handlebars templates for EF Core scaffolding to generate client-side TypeScript observable entities. See [observable-entities-js](https://github.com/TrackableEntities/observable-entities-js) and [EntityFrameworkCore.Scaffolding.Handlebars](https://github.com/ObservableEntities/EntityFrameworkCore.Scaffolding.Handlebars).
> Blog post: [React to JavaScript object updates with observable-entities-js](https://blog.tonysneed.com/2017/09/21/react-to-javascript-object-updates-with-observable-entities-js/)
## Usage
1. Install **Observable Entities for EF Core TypeScript Handlebars Templates**.
```
dotnet new -i ObservableEntities.Core.Templates.TypeScript
```
2. Create a **.NET Core Class Library** project.
3. Add Observable Entities Handlebars templates from the project folder.
```
dotnet new oe-templates-typescript
```
4. Add the following NuGet packages to the project.
- Microsoft.EntityFrameworkCore.Design
- Microsoft.EntityFrameworkCore.SqlServer
- EntityFrameworkCore.Scaffolding.Handlebars
5. Add a `ScaffoldingDesignTimeServices` class that implements `IDesignTimeServices`
```csharp
public class ScaffoldingDesignTimeServices : IDesignTimeServices
{
public void ConfigureDesignTimeServices(IServiceCollection services)
{
// Add Handlebars scaffolding templates
services.AddHandlebarsScaffolding(ReverseEngineerOptions.EntitiesOnly, LanguageOptions.TypeScript);
}
}
```
6. From the command-prompt execute the following:
- Be sure to create the NorthwindSlim database in SQL Local DB,
then run the script from bit.ly/northwindslim.
```
dotnet ef dbcontext scaffold "Data Source=(localdb)\MSSQLLocalDB; Initial Catalog=NorthwindSlim; Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -o Models -f
```