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

Interface definition only generated when document type is in use #232

Open
dhymik opened this issue Feb 8, 2020 · 1 comment
Open

Interface definition only generated when document type is in use #232

dhymik opened this issue Feb 8, 2020 · 1 comment

Comments

@dhymik
Copy link

dhymik commented Feb 8, 2020

Problem:
Interface definition is only generated when document type is used in the site.

Expected bahavior:
The interface definition should always be generated, along with the partial class itself, which is always being generated..

Details:
For a document type used as a composition, I am checking for the interface type in code. However, the interface is only generated when the document type is used as a composition by some other document type. When the composition document type is not used anywhere, the document type's class is still correctly auto-generated, but not the interface. This leads to compile-time errors depending on whether a document type is currently used by other document types, or not.

@dhymik dhymik changed the title Bug: Interface definition only generated when document type is in use Interface definition only generated when document type is in use Feb 8, 2020
@lars-erik
Copy link

@dhymik This is entirely by design. The generated interface is there for compositions because multiple document types implement it. When a doctype is not used as a composition, it is singular and concrete. If you need an interface, you should create your own and make the document type implement it using a partial class definition.
This also goes for any non-generated interface you want to be able to identify or use your document types as.
There is absolutely no need for an interface for every document type in your solution.

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

No branches or pull requests

2 participants