Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial checkin for Reverse Engineering #1601

Closed
wants to merge 65 commits into from

Conversation

lajones
Copy link
Contributor

@lajones lajones commented Feb 12, 2015

This is the initial check in for Reverse Engineering on which we'll iterate. See issue #830.

Features include:
Produces DbContext and EntityType POCO classes in current project.
Outputs class, properties and navigations in EntityType classes and class, DbSet's and OnConfiguring() and OnModelCreating() configuration for DbContext class.
Works from command line like Migrations.
Outputs warnings to command line through a Logger.
Code has been pulled out into separate EntityFramework.Relational.Design and EntityFramework.SqlServer.Design projects.
Supports most SQL Server types (see SqlServerTypeMapping for complete list).
Output fluent API for EntityType defines the schema and table name (if necessary) and the primary key.
Output fluent API for properties outputs appropriate fluent API (as necessary) to determine column name and type, including precision and scale; Identity and StoreComputed columns; and MaxLength.
Output fluent API to support 1:N and 1:1 style navigations, plus self-referencing navigations.
Outputs comments in the generated code if it is unable to generate a) EntityType, b) Navigations.

Features still to be worked on:
Converting the CodeGen side to a template approach.
Using EF to load the metadata.
At the moment always produce Key() fluent API. Work on only doing this only when necessary.
Tests. At the moment the tests were running this in a real project and looking at the output. Need unit tests.
DefaultValue for columns.

… are being looked for in the app project - need to load them from resource.
…very first steps on SQL Server metadata model provider.
… key properties (at the moment just via a non-existent [Key] attribute)
… key properties (at the moment just via a non-existent [Key] attribute)
… the IModel output by the provider and using those annotations to specify the ForeignKey fluent code in OnModelCreating()
…proach. SqlServer Context generation working (not yet EntityType generation).
throw new InvalidProgramException(
"Unable to instantiate type " + type.FullName
+ " in assembly " + providerAssembly.FullName
+ ". Exception message: " + e.Message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.Message is useless here. It will almost always be "Exception has been thrown by the target of an invocation." It's probably better to not catch here. You could also include the exception as an inner exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have changed it so that it no longer catches. But if the error message that comes out is not actionable I think we should change the approach so that the user sees something from the inner exception that can tell them what they did wrong.

@bricelam
Copy link
Contributor

Don't block on any of my comments. :shipit: We can continue the discussion here and resolve them in future PRs and/or design meetings.

@lajones
Copy link
Contributor Author

lajones commented Feb 17, 2015

Checked in after updating based on comments above - #86d32d8.

@lajones lajones closed this Feb 17, 2015
@bricelam bricelam deleted the lajones-150129_ReverseEngineering_10 branch March 13, 2015 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants