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

Migrations code generation. #93

Merged
1 commit merged into from
Apr 14, 2014
Merged

Migrations code generation. #93

1 commit merged into from
Apr 14, 2014

Conversation

ghost
Copy link

@ghost ghost commented Apr 11, 2014

Added MigrationCodeGenerator abstract class, CSharpMigrationCodeGenerator implementation, and dispatch methods for code generators on MigrationOperation classes.
Added Migration abstract class, MigrationBuilder, TableBuilder and ColumnBuilder classes.
Updated relational model and migration model as necessary.
Made ExpressionExtensions public until we decide what to do with shared utilities and resource strings.
Added TypeExtensions and PropertyExtensions to migration utilities.
Added DefaultConstraint struct to better incapsulate the DefaultValue/DefaultSql
Added a bunch of unit tests.

@bricelam
Copy link
Contributor

Can the code generation parts be factored into a separate assembly like Microsoft.Data.Migrations.Design? This is an extension of the pay-per-play principle. If you only ever need to execute this code at design-time, it shouldn't be deployed alongside your application at run-time.


public virtual bool? IsUnicode { get; set; }

// TODO: Implement an annotation mechanism and use it to store the ApiPropertyInfo.
Copy link
Author

Choose a reason for hiding this comment

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

It may be possible to just use the Name of the property info and not have to refer this here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think in the metadata APIs, we give you a way to get the Type and the property name, but we make a point not to hold on to PropertyInfo objects.

@ghost
Copy link
Author

ghost commented Apr 14, 2014

Brice, if my understanding is correct the whole ...Migrations assembly includes "design-time" functionality and is not really needed at run-time, so I am don't think it is necessary to separate the code generation parts into a different assembly. But if you can think of a real-world scenario were that would be helpful, I can easily move those parts into a new assembly.

[CanBeNull] string dataType = null)
{
return BuildColumn(
typeof(Boolean),
Copy link
Contributor

Choose a reason for hiding this comment

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

The guidelines want us to use C# type keywords in favor of .NET type names.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, will update.

@bricelam
Copy link
Contributor

:shipit: This is coming along very well. The best part is: no Visual Basic generator!

Added MigrationCodeGenerator abstract class, CSharpMigrationCodeGenerator implementation, and dispatch methods for code generators on MigrationOperation classes.
Added Migration abstract class, MigrationBuilder, TableBuilder and ColumnBuilder classes.
Updated relational model and migration model as necessary.
Made ExpressionExtensions public until we decide what to do with shared utilities and resource strings.
Added TypeExtensions and PropertyExtensions to migration utilities.
Added DefaultConstraint struct to better incapsulate the DefaultValue/DefaultSql
Added a bunch of unit tests.
@ghost ghost merged commit a876584 into dev Apr 14, 2014
@ghost ghost deleted the Migrations_CodeGen branch April 14, 2014 22:09
@divega
Copy link
Contributor

divega commented Apr 15, 2014

Not sure if you guys talked about this offline, but regarding the idea of a design-time assembly, to me the point is that some parts of Migrations can be considered more design-time-ish than others, e.g. while the ability to execute a migration is something that can be done at runtime by any application and shouldn't require extra dependencies to do it programmatically, the code generation part is something that is typically only done while in de IDE. Is this reason enough to create a separate assembly? I don't know but seems worth considering.

@ghost
Copy link
Author

ghost commented Apr 15, 2014

I will move the code generation class into a separate assembly as Brice suggested. However, it may be better to move the migration operations into the Relational assembly in which case there won't be a need to create this extra assembly with one class. Those operations are practically database operations, not really migration operations.

anpete added a commit that referenced this pull request May 12, 2015
- Remove remaining DbDataReader dependencies from query processing - Use ValueBuffer everywhere.
- Removed offsetting from ValueBuffer factory factories.
- Enables dynamic ValueBuffer index re-mapping for FromSql non-composed projection out-of-order scenarios.
- Adds workaround for IX-Async #93
- Enables Select op over non-composed FromSql queries!

dprun: 100%
anpete added a commit that referenced this pull request May 13, 2015
- Remove remaining DbDataReader dependencies from query processing - Use ValueBuffer everywhere.
- Removed offsetting from ValueBuffer factory factories.
- Enables dynamic ValueBuffer index re-mapping for FromSql non-composed projection out-of-order scenarios.
- Adds workaround for IX-Async #93
- Enables Select op over non-composed FromSql queries!

dprun: 100%
anpete added a commit that referenced this pull request May 13, 2015
- Remove remaining DbDataReader dependencies from query processing - Use ValueBuffer everywhere.
- Removed offsetting from ValueBuffer factory factories.
- Enables dynamic ValueBuffer index re-mapping for FromSql non-composed projection out-of-order scenarios.
- Adds workaround for IX-Async #93
- Enables Select op over non-composed FromSql queries!

dprun: 100%
This pull request was closed.
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.

2 participants