Dot Net Core 3.1 Code generator v1.0

This will generate repository pattern classess, razor views, controller, api controller, meme cache, validations and auto mapping
For feedback and bugs please feel free to reach us support at cuetech dot in

  • The name of primary key field should be ID
  • Only one primary key allowed per table
  • First field should be the primary key
# Names & Default Data Type & Control Length Keys & Props Visibility Relations Validations
1
2
3
4
5
6
7
8
9
10
11
12

Readme

The generated code is tested against dot net core 3.1

Database tested SQL Server, MySql, SqLite and PostgreSQL

Steps

  1. Create Dot Net Core 3.1 web application
  2. Add these packages
    1. <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
    2. <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
    3. <PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
    4. <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />
    5. <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.8" />
    6. <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" />
    7. <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.8" />
    8. <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.8" />
    9. If you want to use another database , uncomment the relevant one and change the connecting part inside startup <!-- <PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.22" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.8" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />-->
    10. <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference>
    11. <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
    12. <PackageReference Include="System.Drawing.Common" Version="5.0.0" />
    13. <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.8.0" />
    14. <PackageReference Include="System.Runtime.Caching" Version="4.7.0" />"
    15. <PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.10" />"
  3. Create database in SQL Server
  4. Add connection string to appsettings.json
    "ConnectionStrings": { "Sql": "Data Source=ServerName;Initial Catalog=YourDatabaseName;persist security info=True;user id=UserID;password=Sql@2012Password" },
  5. Generate code through this page
  6. Create pages and folders as per the Namespace structure
  7. Paste the code from this page to your newly created pages
  8. Compile your project
  9. After copying do migration commands in package manager console
    add-migration first
    update-database

Model

CRUD Model

Response Model

DB Context entries

Mapping

Interfaces

Service

Controller

Index View

Create View

Edit View

Edit View

Startup

Validations

API

Memcache

Your data

Save it as a json. You can later load it again !!!!

to do logger