Automatic class generator

4

How do I get an entity in the DB (Oracle) and generate a class on my system that represents that entity?

Ex: I have this entity

  

Customer

     

ID int primary key

     

Name varchar (100)

And now with the tool it already generates this:

using System;
using System.Data;

namespace meu_projeto.meu_folder.classes
{
public class Cliente{

    public int ID { get; set; }
    public string name { get; set; }

  }
}

That is, generating a POCO class based on a DB entity (Oracle), how do I do it?

I'm using WPF for this.

    
asked by anonymous 17.02.2016 / 11:56

1 answer

3
With the core version of Entity Farmework you can use the direct command line in the Package Manager Console
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

Being necessary to have the following packages:

Install-Package Microsoft.EntityFrameworkCore.SqlServer
Install-Package Microsoft.EntityFrameworkCore.Tools
Install-Package Microsoft.EntityFrameworkCore.SqlServer.Design

While this example is for Sql Server, but I believe that for Oracle it would only use the Providers provided by Oracle

    
13.03.2017 / 17:09