Coder Social home page Coder Social logo

wushian / entityframework-reverse-poco-code-first-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sjh37/entityframework-reverse-poco-code-first-generator

0.0 1.0 0.0 5.85 MB

EntityFramework Reverse POCO Code First Generator - Beautifully generated code-first code that is fully customisable. If you were to reverse engineer a database by hand, and lovingly create the code-first code, this is exactly what this generator creates.

Home Page: http://www.ReversePoco.com

License: Other

C# 99.78% Batchfile 0.22%

entityframework-reverse-poco-code-first-generator's Introduction

EntityFramework Reverse POCO Code First Generator

Beautifully generated code first code that is fully customisable

  • Downloadable VSIX installer from the visual studio gallery. Visual Studio Partner
  • Watch the in-depth course at pluralsight logo I cover everything this generator can do, and show you step-by-step how to reverse engineer your database properly.

Project Description

Reverse engineers an existing database and generates Entity Framework Code First Poco classes, Configuration mappings and DbContext.

Please note, this is not the Microsoft reverse generator. This is one I created to generate beautiful code-first code, as if I had hand-crafted the code-first code myself. It also allows me to customise the generated code to my liking.

What's new

Click here to see what's new in this release.

Donation

To make a donation via PayPal, please click here.

Supported databases

  • SQL Server
  • SQL Server Compact 3.5 and 4.0

Highly customisable output

This generator was designed to be customisable from the very beginning, and not fixed and rigid like other generators. Go and play with the settings in the <database>.tt file, that's what it's there for.

If your database changes, simply re-save the <database>.tt file. That's it.

Click here to see a full list of features.

To install and use this project:

  • For Visual Studio 2012 & 2013, install Entity Framework 6 Tools available here This installs the required EF6.Utility.CS.ttinclude which is used for pluralisation You only need to do this once.
  • Use Nuget and install EntityFramework.
  • Add a connect string to your app.config. Something like:
<connectionStrings>
  <add name="MyDbContext"
       providerName="System.Data.SqlClient"
       connectionString="Data Source=(local);Initial Catalog=MyDatabase;Integrated Security=True; />
</connectionStrings>
  • The connection string you use must have at least these privileges: ddladmin, datareader and datawriter. ddladmin is required for reading the default constraints.
  • In Visual Studio, right click project and select "add - new item".
  • Select Online, and search for reverse poco.
  • Select EntityFramework Reverse POCO Generator.
  • Give the file a name, such as Database.tt and click Add.
  • Edit the Database.tt file and specify the connection string as "MyDbContext" which matches your name in app.config.
  • Save the Database.tt file, which will now generate the Database.cs file.
  • There are many options you can use to customise the generated code. All of these settings are in the Database.tt files.

UI

A simple UI for the generator is available at GitHub which helps you to create a regex to filter your tables.

Editing TT (T4) Files

To have full syntax highlighting and intellisense when editing TT files, I use the Resharper plugin ForTea. I can't imagine editing TT files without it.

Getting a pull request accepted

Have a read of [https://github.com/blog/1943-how-to-write-the-perfect-pull-request](How to write the perfect pull request)

My requirements are simple:

  1. Always keep the changes to a minimum, so I can see exactly what's changed in regard to the pull request. I.e. No whitespace tidy up, etc.
  2. No tabs, only spaces (4).
  3. Don't move functions about, please leave them where they are.
  4. No new files. This will always get rejected. Add any new code/classes into the two existing .ttinclude files.
  5. Don't be tempted to do a few different enhancements in one pull request. Have one pull request for one bug fix / enhancement.

Regards, Simon Hughes

entityframework-reverse-poco-code-first-generator's People

Contributors

0xced avatar andygjp avatar bdn-mca avatar bogatykh avatar chris3773 avatar cody1024d avatar damianreeves avatar davidsk avatar drizin avatar dyardygit avatar ericsmall avatar erikej avatar flcdrg avatar grudolf avatar jaxidian avatar jimmystridh avatar jondavis9898 avatar kyohei0806 avatar mdentremont avatar meixger avatar patrickmcdonald avatar phofman avatar piqm avatar rajjan avatar rdrscan avatar samartzidis avatar sjh37 avatar spreegabe avatar staff0rd avatar timsirmovics avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.