How to start a ConsoleApplication that generates all objects in the database equal to CodeFirst

1

Hello! to all

I'm starting a project in Console Application in C #, I've read a lot about Entity Framework, Code First, Migrations.

The purpose of this project is to generate all the tables of a database schema in Data Models, I ask your help for this. My doubts are as follows! below:

I want to do the same as the Visual Studio add-in called 'Code First' however I want to generate the models (Model Domain, Model Dto, Model Service) in different paths, the idea of this generator is to automate generation of these Models.

Someone would ask why not use Code First tals, because then, Code First generates everything I need but I want with nomenclatures that I can put when generating the object understand ex:

Database

  • ad_escola
  • ad_person
  • ad_aluno
  • ad_professor

Based on the tables I want to generate in an organized way

Data Layer (this will be a Windows Library Project).

  • School.cs
  • EscolaMapper.cs

  • Persona.cs

  • PersonaMapper.cs

  • Student.cs

  • StudentMapper.cs

  • Professor.cs

  • ProfessorMapper.cs

Domain Layer (will be a Windows Library Project) already with Add, Get, Edit, etc. methods

  • School.cs
  • Persona.cs
  • Student.cs
  • Professor.cs

Dto layer (it will be a Windows Library Project).

  • Dto.cs
  • PersonaDto.cs
  • AlunoDto.cs
  • ProfessorDto.cs

Service Layer (it will be a Windows Library Project) that returns objects already mounted by the Domain, it will communicate with Front End or Presentation Layer.

  • SchoolSevice.cs
  • PersonaSevice.cs
  • AlunoSevice.cs
  • ProfessorSevice.cs

Details, this generator can be used at any stage of the project, if I create a new table in the project, I will use it to generate the Templates for this new table in the database. My question is how can I get all the tables from the bank and generate this in a very simple initial way.

For more information, I created a project in GitHub for those who want to help develop it. talking to me, and working together and the Code Generator, will be for all those who help, it's a great idea from my point of view.

At first I wanted to make him see 3 main databases that are common today:

  • SQLServer
  • Oracle
  • MySql

GitHub data

Those who want to help develop this small project, talk to me and pass me the GitHub user because I will add it as "Contributor from Project", there you can develop and give Commit and the GitHup Repository will always have the latest version updated to all those who contribute.

I await tips, suggestions from the entire community. Hugs.

    
asked by anonymous 20.04.2015 / 18:30

1 answer

0

This already exists. It calls ASP.NET MvcScaffolding , but the project was abandoned because Microsoft abandoned DTE support in Visual Studio 2013, privileging the Visual Studio context menus.

Another thing that might be interesting for your project is the SideWaffle, template generator for extensions for Visual Studio . It may even be more interesting than calling the console commands.

UPDATE

Just fanning out what I've already said here and here , MvcScaffolding has been updated to VS2015 . The latest version is for VS2015 and VS2013. Just use the latest version if you have both Visual Studio, otherwise use version 1.0.10 locked in the packages.config file as follows:

<packages>
    <package id="MvcScaffolding.VS2015" version="1.0.10" targetFramework="net452" allowedVersions="[1.0.10]" />
    <package id="T4Scaffolding.Core.VS2015" version="1.0.1" targetFramework="net452" allowedVersions="[1.0.1]" />
    <package id="T4Scaffolding.VS2015" version="1.0.8" targetFramework="net452" allowedVersions="[1.0.8]" />
</packages>
    
21.04.2015 / 00:09