How to start a Consoleapplication that manages all database objects equal to Codefirst

Asked

Viewed 145 times

1

Hello! to All

I am starting a Console Application project in C#, I have 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 for your help for this. My doubt is as follows! below:

I want to do the same as the Visual Studio add-in called 'Code First' but I want to generate the models (Model Domain, Model Dto, Model Service) in different paths, the idea of this generator is to automate the 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 classifications that I can put when generating the object understand ex:

Database

  • ad_escola
  • person
  • student
  • teacher

Based on the tables I want to generate organized

Data Layer (sera a Windows Library Project).

  • Escola.Cs
  • Escolamapper.Cs

  • Pessoa.Cs

  • Pessoamapper.Cs

  • Pupil.Cs

  • Alunomapper.Cs

  • Professor.Cs

  • Professormapper.Cs

Domain layer (sera a Windows Library Project) already with Add, Get, Edit, etc methods.

  • Escola.Cs
  • Pessoa.Cs
  • Pupil.Cs
  • Professor.Cs

Dto layer (will be a Windows Library Project).

  • Escoladto.Cs
  • Personal.Cs
  • Alunodto.Cs
  • Professordto.Cs

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

  • Escolasevice.Cs
  • Pessoasevice.Cs
  • Hallucinogenicvice.Cs
  • Professorsevice.Cs

Details, this generator I can use in any phase of the project, if I create a new table in the project, I will use it to generate the Templates of this new table of the bank. My doubt is how I can take all the tables of the bank and generate it in a very simple initial way.

For more information I created a project on Github that I want to help develop is just talk to me, and we work together and the Code Generator, will be for all those who help, is a great idea from my point of view.

At first I wanted to make him see 3 major databases today common:

  • Sqlserver
  • Oracle
  • Mysql

Data from Github

Those who want to help develop this small project, talk to me and pass me the Github user because I will add as "Contributor from Project"then you can develop and commit and in the Githup Repository you will always have the latest updated version for all those who contribute.

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

1 answer

0


This already exists. Flame ASP.NET Mvcscaffolding, but the project was abandoned because Microsoft abandoned DTE support in Visual Studio 2013, privileging generation through Visual Studio context menus.

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


UPDATE

Just venting what I’ve already said here and here, the Mvcscaffolding has been upgraded to VS2015. The latest version is for VS2015 and VS2013. Only use the latest version if you have both Visual Studio, otherwise use version 1.0.10 locked in the file packages.config 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>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.