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

Design: Refine code generation APIs #10481

Merged
merged 1 commit into from
Dec 5, 2017
Merged

Design: Refine code generation APIs #10481

merged 1 commit into from
Dec 5, 2017

Conversation

bricelam
Copy link
Contributor

@bricelam bricelam commented Dec 5, 2017

This removes the concept of the programming language from the provider APIs.

/// A service typically implemented by database providers to generate code fragments
/// for reverse engineering.
/// </summary>
public interface IScaffoldingProviderCodeGenerator2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will rename 😏


foreach (var argument in arguments)
{
Arguments.Add(argument);
Copy link
Contributor

Choose a reason for hiding this comment

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

AddRange or ctor args to create the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IList doesn't have AddRange, and I couldn't see an already existing extension method.

Copy link
Contributor

@smitpatel smitpatel left a comment

Choose a reason for hiding this comment

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

Looks good.
Though we are dropping one function for provider here. Provider can no longer generate something custom based on connection string. Not sure how useful it is. Awaiting rename for sign-off

@bricelam
Copy link
Contributor Author

bricelam commented Dec 5, 2017

Looks like I need to update Oracle more too...

@bricelam
Copy link
Contributor Author

bricelam commented Dec 5, 2017

Provider can no longer generate something custom based on connection string.

Yeah, I debated whether to use MethodCallCodeFragment here too...

@smitpatel
Copy link
Contributor

I was thinking more like, for SqlServer provider, provider can use connection string to find out server version and call those additional things like
UseSqlServer("connectionString").UseRowNumberPaging()
May be a list of MethodCallFragment can represent it.

@bricelam
Copy link
Contributor Author

bricelam commented Dec 5, 2017

We'll YAGNI it for now. Now we can actually evolve this service without breaking providers. 😉

@bricelam
Copy link
Contributor Author

bricelam commented Dec 5, 2017

Filed #10487

This removes the concept of the programming language from the provider APIs.
@@ -26,6 +26,7 @@ public static class ScaffoldingServiceCollectionExtensions
public static IServiceCollection AddScaffolding([NotNull] this IServiceCollection serviceCollection, [NotNull] IOperationReporter reporter)
=> serviceCollection
.AddSingleton<AnnotationCodeGeneratorDependencies>()
.AddSingleton<CoreTypeMapperDependencies>()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We really need to add more RevEng tests. (#9111) I'll try to get to it soon.
cc @ajcvickers

@bricelam bricelam merged commit 764b139 into dotnet:dev Dec 5, 2017
@bricelam bricelam deleted the ast branch December 5, 2017 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants