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

More complex project examples #20

Closed
ghost opened this issue May 23, 2018 · 5 comments
Closed

More complex project examples #20

ghost opened this issue May 23, 2018 · 5 comments

Comments

@ghost
Copy link

ghost commented May 23, 2018

Hi, I'm trying to implement Dapper.GraphQL and streamline the process of adding our several models.

The existing examples are great but I'm having a bit of difficulty on understanding how to put the pieces together when considering several models in a big project. Based on the existing examples, is it possible to have a single Schema for all of our queries, for example? If not, how should I properly DI them into my single GraphQL controller? The example seems a bit locked on PersonSchema.

Also, should I just assume we'll need an EntityMapper, Query, QueryBuilder, Schema, Type and Model for each Model in our business logic, from which we manually add each Type, Query, Schema and QueryBuilder to DapperGraphQL options on services configuration @ Startup.cs? Would that be best practice? Is there any way to do so dynamically?

Some hints would be greatly appreciated!

@dougrday
Copy link
Member

Based on the existing examples, is it possible to have a single Schema for all of our queries, for example?

Yes. You can certainly have a single schema and query, and have as many operations based on that as needed. In our more complex projects, that's how it's setup.

Also, should I just assume we'll need an EntityMapper, Query, QueryBuilder, Schema, Type and Model for each Model in our business logic, from which we manually add each Type, Query, Schema and QueryBuilder to DapperGraphQL options on services configuration @ Startup.cs?

This sounds correct.

Would that be best practice?

As this is such a new library, best practices are evolving. But, as it stands, that's the best way to do it.

Is there any way to do so dynamically?

This could be a good idea for a new feature. It would certainly make managing the DI environment easier (e.g. no more "ah heck, I forgot to add it to DI")

@ghost
Copy link
Author

ghost commented May 24, 2018

Thank you @dougrday, your input was exactly what I was looking for.

@ghost ghost closed this as completed May 24, 2018
@dougrday dougrday reopened this May 24, 2018
@dougrday
Copy link
Member

I'll be adding more complex examples to the project as part of this issue. Stay tuned...

@ghost
Copy link
Author

ghost commented May 25, 2018

Great! Looking forward to it.

dougrday added a commit that referenced this issue May 31, 2018
dougrday added a commit that referenced this issue Jun 1, 2018
- Convert unit tests to use PostgreSQL instead of MSSQL\localdb
- Add additional complexity to the test data to ensure a variety of test cases are met
- Use Docker to run the test cases by default
dougrday added a commit that referenced this issue Jun 4, 2018
- Ensure inserts work properly with PostgreSQL
- Fixed remaining unit tests
@dougrday
Copy link
Member

dougrday commented Jun 4, 2018

@nunogois OK, I've implemented some more complex examples.

It includes:

  1. Entity deduplication at the database level (see MergedToPersonId in Person.cs and PersonQueryBuilder.cs).
  2. Association tables that are not models, nor take part of the entity mapping process (see PersonQueryBuilder.cs).
  3. Note that entity mapping has recently improved significantly (see PersonEntityMapper.cs).

dougrday added a commit that referenced this issue Jun 4, 2018
@dougrday dougrday added this to the 0.3.10-beta milestone Jun 4, 2018
@dougrday dougrday closed this as completed Jun 4, 2018
dougrday added a commit that referenced this issue Jun 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant