-
Notifications
You must be signed in to change notification settings - Fork 16
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
Switch automatic Ontologies.g.cs generation off #14
Comments
Not that I am aware of at the moment. But I think it would be a good idea to introduce such an option. The generation is triggered in the following file: https://github.com/semiodesk/trinity-rdf/blob/master/Trinity/Targets/Semiodesk.Trinity.targets We need to add a condition here that can be changed in the project settings. I am not to deep into the build system so I currently have to idea on how to implement this. Another solution would be not to have the ontology generator overwrite the files if they are identical. That should be fairly easy to do.. what do you think? |
Just saw that the ontology generator reads the project's ontology.config file. We could add an option there to disable the generator: https://github.com/semiodesk/trinity-rdf/blob/master/Trinity.OntologyGenerator/Program.cs Not overwriting identical files would probably still not a bad idea, given that some toolchains seem to care about this. |
Found a workaround for 1.0.3.50 version: <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<ontologies namespace="Domain.AutoGeneratedOntologies" >
<!-- Uncomment to enable Ontologies.g.cs auto-generation
<ontology uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#" prefix="rdf"> <filesource location="Ontologies/rdf.ttl"/> </ontology>
<ontology uri="http://www.w3.org/2000/01/rdf-schema#" prefix="rdfs"> <filesource location="Ontologies/rdfs.ttl"/>
-->
</ontologies>
</configuration> When ontologies will need an update, I'll be able to handle that:
|
@faubulous I would expect some sort of switch in ontology.config to support both modes: auto/manual generation of Ontologies.g.cs. As for auto: everything is left as it is designed. The manual mode would be great to have a command sent directly from the package manager console (as scaffold or add-migration in ef) a simple console app would also be fine. |
@IgorKaplya Great that you found a workaround! However, adding a switch to ontology.config should not be a big deal and I'll try to add it for the next version of Trinity. Btw. the ontology generator is already a simple console app which is shipped with the NuGet package. It should also work standalone: https://nuget.info/packages/Semiodesk.Trinity/1.0.3.50 Look for
Running |
The autogeneration behavior produces a lot of pitfalls during CI/CD pipelines, as follows:
Though I definitely know that my Ontologies.g.cs is consistent and OymOntology.oym class was not ambiguous when pushed to Git.
Steps to reproduce:
CSharpErrors
(otherwise code is considered faulty and not accepted as valid PR),It is very hard to say what exactly causes this issue, I can only assume that R# builds the project and ontologies.g.cs become dirty after that (same command with
--verbosity=verbose > output.log
contains on a log file:Is it possible to switch off auto-generation of Ontologies.g.cs?
The text was updated successfully, but these errors were encountered: