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
|
Hello Guys, I have created two models with 4 common tables but when I am compiling the code, I am getting following error: 'The type 'DHVCortexService.Business_models.WbWegvakFoto' already contains a definition for '_wvfoFilename' Above error is for each field for each repeated table. I can solve this by renaming the table in another model but I am looking for any other appropriate solution for the same. Regards, DHV |
|
|
Use the Linked Models feature. Define each entity in only one model, and use entity links when you need to refer to it in the other model (you can use Copy / Paste as Link to quickly create these links). See http://www.mindscape.co.nz/blog/index.php/2010/05/31/large-models-in-lightspeed-3-1-part-2/ for info. |
|
|
Thanks Ivan, I have defined linked entities but it seems to me that there is something wrong. When I goto linked entity then I got a message that "Could not find the definition of Bbgeoobject (table name) in any linked model. The name of both models is same and linked model is "LINKED CHILD". Where I am doing wrong? Regards, DHV |
|
|
In addition to above, I am not be able to get the results form a query which was working fine earlier. Is this also because of the issue that can not find the linked table? |
|
|
Is it possible that you have made Bbgeoobject a link on both models? The entity should be fully defined in one model, and then be a link everywhere else. If that's not the issue, could you post the models? We don't really have enough information to diagnose the issue at the moment. (You can attach a zip file via the Options tab.) Thanks! |
|
|
Dear Ivan, I have attached business models. Basisbeheer model has original definition of BbGeoobject and its link has been used in the Rioleringsbeheer model. Regards, DHV |
|
|
When I run Check Links on your models, the only error I see if that the BbGeoObject <-> RbStreng association isn't present in BasisBeheer.lsmodel. Could that explain the query that stopped working? When I add that back in, it all seems to be fine. Go To Linked Entity also seems to be working correctly. Is it possible that you hadn't yet saved the linked models when you were getting the error? Are you still seeing the Go To Linked Entity error in your project? |
|
|
If I add table RbStreng in basisbeheer model then I have following problem: 1. When I split at association then Lightspeed will create a new model with linkage of rbstreng and bbgeoobject but I want both rbstreng and rbput in the same model. 2. Can I use linked rbstreng to Rioleringsbeheer model because both Rbstreng and rbput are associated with another three tables i.e. RbBemgebied, RbKwalmeetgegev and RbOnderhoudsgroepen. I have tried by paste as link but then I am not getting the existing association. Goto linked entity is still not working. Regards, DHV |
|
|
1. You MUST have a link to RbStreng in the BbGeobject file: because the association spans two files, it has to be declared in both files, so the other end has to be linked. You can leave RbStreng and RbPut both in the Rb model: just do a copy/paste as link of RbStreng into the Bb model and add a copy of the association to BbGeoobject. Don't worry about Split At Association: that's a fairly simplistic tool for when a model needs to be split into a new file, and you're now maintaining a set of existing files rather than needing to create new ones. 2. Yes, you can. The only associations that need to be declared in both files are the ones that span the files. The association from, e.g. RbStreng to RbBemgebied, is internal to the Rb file: it doesn't spill over into the Bb file. I've attached a file your files as I updated them. These are definitely working for me. Can you try loading them into your project (or an empty project) and let me know if you still get the error? Also can you make sure you are using a current nightly build? |
|
|
Oops, forgot to attach the file. Here it is. |
|
|
Thanks for your efforts Ivan, I have used the models which were updated by you but unfortunatly I am still not be able to execute the query and goto the linked entities. Earlier I was not using the current nightly build but I have downloaded and tried the same with current nightly build but no success. DHV |
|
|
Dear Ivan, I have figured out the problem. Actually I have dragged the supportive tables first and then main tables so Column Name was null on the associations. When I given the column name to each association, I got the result. However goto linked entities is still not functioning but its not very importent also. Thanks for your support. Now I have one more issue, I have override the GeneratedID to get allocatedID but whenever I change something in model, my override function swept away and I have to write the function again. Do you have any idea so that it will not change with the change in model? Regards DHV |
|
|
You need to implement GeneratedId in a partial class rather than editing the generated code. You can create a partial class file normally using the Visual Studio Add > Class command, or a quick way to create a partial class file for an entity is to right-click the entity and choose Refactor > Create Partial Class. |
|
|
Thank you very much Ivan. That really helped me. I have a small query. The column putID in table rb_put is linked with two columns beginputID & eindputID of table rb_streng. I made a join of this table: join rbputbegin in _context.RbPuts on strengs.PutBeginId equals rbputbegin.Id join rbputeind in _context.RbPuts on strengs.PutEindId equals rbputeind.Id select new { PUTBegin = rbputbegin.PutNummer, PUTEind = rbputeind.PutNummer } But I am getting the same result (PUTBegin) for both begin and eind. Problem will solve if I add another table rb_put and rename it rb_put1 and query but I dont want to use that. Any suggestions? DHV |
|
|
What version of LightSpeed are you currently using? We have made some improvements to the join functionality over the 3.1 nightlies which I believe may address the scenario you are describing above. If you are using the current nightly build, would you be able to provide a small repro of the above problem and we can have a look into what the issue might be.
Jeremy |
|