Having the same complex type multiple times in a table
Having the same complex type multiple times in a table
Is there a way to have the same complex type in a table multiple times?
I have a Complex Type called cChance and I have 6 of them in my table and I try to generate the script for the database none of them are in the script. But if I remove all but 1 of the cChances it appears in the script when I generate it.
I also tried making a simple project and I am seeing this happen as well.
I have a Complex Type called cChance and I have 6 of them in my table and I try to generate the script for the database none of them are in the script. But if I remove all but 1 of the cChances it appears in the script when I generate it.
I also tried making a simple project and I am seeing this happen as well.
Re: Having the same complex type multiple times in a table
To have the same complex type in a table multiple times, you should change Source column for each property of the each complex type. This can be done in the Entity Сlass Mapping Details (available from the shortcut menu of your Entity Class). You should change the Column name for each type to the corresponding column in the database table, or, if table doesn't exist yet, modify them so that they differ from each other.
Re: Having the same complex type multiple times in a table
Ahh well that is a relief. Could you guys add some sort of automation so that you don't have to type all these mappings out by hand? I had one table that had 20+ complex types in it is a big pain having to type them all out by hand.
Re: Having the same complex type multiple times in a table
Thank you for your suggestion. We currently have no plans for implementing it, but you can post it at our UserVoice (devart.uservoice.com) so that other users can support it.
Also, we would be grateful if you describe how exactly you see this feature (precisely, what algorithm should be used for renaming the complex type fields).
Also, we would be grateful if you describe how exactly you see this feature (precisely, what algorithm should be used for renaming the complex type fields).
Re: Having the same complex type multiple times in a table
Thanks again for the aid.
When you do Model first I know Microsoft's Entity Framework is smart enough to do the mappings for you. It would be nice in your designer did this as well. I had a situation where I had a complex type that has 6 properties and this complex type was used about 20 times in a single table. Doing this by hand in the Mapping dialog was not very easy and it was very time consuming. Try doing this scenario yourself and you will have a seriously cramped wrist as well since that dialog doesn't make doing mass edits very easy.
It would be nice to have a option for it to do the mapping for you perhaps like:
TableCProperty_ComplexProp0
TableCProperty_ComplexProp1
TableCProperty_ComplexProp2
TableCProperty_ComplexProp3
TableCProperty_ComplexProp4
TableCProperty_ComplexProp5
I will also post this suggestion in the UserVoice.
When you do Model first I know Microsoft's Entity Framework is smart enough to do the mappings for you. It would be nice in your designer did this as well. I had a situation where I had a complex type that has 6 properties and this complex type was used about 20 times in a single table. Doing this by hand in the Mapping dialog was not very easy and it was very time consuming. Try doing this scenario yourself and you will have a seriously cramped wrist as well since that dialog doesn't make doing mass edits very easy.
It would be nice to have a option for it to do the mapping for you perhaps like:
TableCProperty_ComplexProp0
TableCProperty_ComplexProp1
TableCProperty_ComplexProp2
TableCProperty_ComplexProp3
TableCProperty_ComplexProp4
TableCProperty_ComplexProp5
I will also post this suggestion in the UserVoice.
Re: Having the same complex type multiple times in a table
Thank you, we will consider the possibility of adding this functionality and inform you about the results. However, there is no timeframe available at the moment.
Re: Having the same complex type multiple times in a table
Hello,
Could I urge you guys to consider adding this feature (perhaps as a option that you can turn on and off)? I had to re-map by hand about 80 complex types (each with 6-12 properties) in a project of mine. I have also had to do this many times in the past. This is causing me to lose a significant amount of time doing this plus it is killing my wrist.
Could I urge you guys to consider adding this feature (perhaps as a option that you can turn on and off)? I had to re-map by hand about 80 complex types (each with 6-12 properties) in a project of mine. I have also had to do this many times in the past. This is causing me to lose a significant amount of time doing this plus it is killing my wrist.
Re: Having the same complex type multiple times in a table
Currently, LinqConnect supports such scenarios for Model First approach. To implement such a scenario, you can use advanced database naming rules - set database naming rules and names for the properties in the entity class. Please refer to the Entity Developer documentation: Orm Support-> NHibernate-> Customizing Model Properties-> Synchronization-> Database Naming-> Advanced
The article is about NHibernate, but the principle is the same. We will add the similar description for LinqConnect models, too.
We are sending you a test model to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter.
Please tell us if this helps.
The article is about NHibernate, but the principle is the same. We will add the similar description for LinqConnect models, too.
We are sending you a test model to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter.
Please tell us if this helps.
Re: Having the same complex type multiple times in a table
Awesome! I did a few small tests and it seems to be working the way I like. Was this a new feature?
Thanks for the help!!!
Thanks for the help!!!
Re: Having the same complex type multiple times in a table
Yes, the capability for setting special rules for generating default names of database objects when using the Model First approach was implemented starting from LinqConnect 4.2.222 (a new Advanced page was added to the Synchronization->Database Naming section of the Model Settings dialog box).