-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
EF Core Code Generation MVP #4073
Conversation
@michaelstaib , this is ready for review really. Tomorrow I'm gonna:
But you should start reviewing it in any case if you have the time. |
{ | ||
public partial class EntityFrameworkSourceGenerator | ||
{ | ||
private const string _dll = ".dll"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do not need this once I have merged my generator improvements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have those improvements made it in? Looks like Neo4J equivalent is doing the same thing still but let me know if I need to adjust anything, though perhaps better as a new branch.
...otChocolate/CodeGeneration/src/CodeGeneration.EntityFramework/EntityFrameworkSchemaHelper.cs
Outdated
Show resolved
Hide resolved
{ | ||
public class ForeignKeyDirective | ||
{ | ||
public string To { get; set; } = default!; // TODO: Potentially this supports nullable and can be derived by the field it annotates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once I reworked directives we could also have a constructor that passes this in.
src/HotChocolate/CodeGeneration/src/CodeGeneration.EntityFramework/Types/ManyToManyDirective.cs
Show resolved
Hide resolved
|
||
namespace HotChocolate.CodeGeneration.EntityFramework.Types | ||
{ | ||
public class OneToManyDirective |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is nice that you collocate the type wit the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I know it was against the original code but it made it a lot easier to copy-paste and easier to build out. They're fairly light on, so I think it's ok.
/AzurePipelines run |
Azure Pipelines successfully started running 3 pipeline(s). |
SonarCloud Quality Gate failed. |
…es have been processed. This sets us up to inspect relationships in more detail.
@@ -17,6 +18,8 @@ public interface IDirective | |||
|
|||
T ToObject<T>(); | |||
|
|||
T ToObject<T>(Type type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelstaib , would this be a problem?
I have a scenario where I'd like to be able to loop the directives of a field, finding those that implement an interface, but then actually get the directive class, but .ToObject<T>
doesn't cut it as T in my case would be an interface and the Activator code fails. Have a look at how it's used in SchemaExtensions::GetDirectivesWhereRuntimeTypeImplements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage:
directive.ToObject<IXyzDirective>(directive.Type.RuntimeType)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Adds EF Core code generation and an analyzer so that we can go SDL-first --> EF model --> DB.
Functionality:
Query
type generationConcepts:
Testing: