This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Dear All; We are using nhibernate in projects and we have models per module. Example :
We want to connect (many to one, one to many, many to many) two entities (user and order). Is it possible? If possible how? Best regards..... |
|
|
No this is not possible through the designer directly. If you need to define relationships between the entities defined on multiple models you will need to define these manually on a partial class. You can also set the generation mode for any FK values to be field or mapping only if required to assist with this.
|
|
|
This is very bad. :( We love this tool so much. Maybe this is not possible for me but you can make add this feature in tools with some developing. :) |
|
|
Its possible as we do have something similar for LightSpeed, however its not very practical for us to port this over so at this stage we are not planning on adding in support for this. If you would like add a feature request for this in the feature request section and if we get strong interest in this then we can certainly look into this for a future release.
|
|
|
Dear Jeremy; We are using FluentNhibernate Map Code Generate Policy on nhibernate designer. Do you know we are training different nhmodels connect. Nhibernate Designer Tools can not create partial Mapping class. How can i manual mapping for different nhmodels objects. And Can work update database from model.... |
|
|
Sorry for the delay in replying to this. Can you elaborate on what you mean by "can not create partial Mapping class"? You can control the generation options for entities and their properties by using the "Generation" property in the properties tab in both cases to control what the code gen will emit and then you can implement the remainder in a partial class as required - does this cover what you are looking to achieve?
|
|
|
Thank you for your reply. We can do what you suggested for sure, but there is a tiny problem. Let me explain the steps that we follow: 1) We create the entity model with properties 2) We generate the code and mappings using your tool 3) We add some mappings to the generated code for remaining properties 4) Whenever we change something in the model, the tool re-generates the codes and mappings, so we lose custom mappings I hope it is clear enough. If you have an example code of what you suggested before, that would help a lot. The main reason of why we need this functionality is that we have entities which are mapped to different DBs (some are mapped to Oracle, some are mapped to SQL). Best Regards... |
|
|
If you are editing the code files which the designer generates then yes these will be regenerated each time you save the model. If you want to add custom code and have this retained through successive generations then you will need to implement this as a partial class in a separate code file - generally most people handle this as a single file per class. The generated class definitions are already marked as partial so you can implement your custom code in a seperate partial definition.
|
|