Change collection-type in .hbm-files?

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Obi Bieber
Posts: 4
Joined: Thu 12 Jun 2014 12:12

Change collection-type in .hbm-files?

Post by Obi Bieber » Thu 12 Jun 2014 12:27

Dear Sir or Madam,

in our current project we make great use of Entity Developer in combination with .net and wpf. The problem was: How to make Iesi.Collection.ISet notifyable as for example ObservableCollection<T>. We have solved this issue using our own classes like PersistentObservableSet, ObservableHashedSetType and ObservableSet. Also we have modified the default template file (.tmpl) of Entity Developer to modify the Type of the collections in the .cs-Domain-files. In our mapping files (hbm.xml) however we defined the collection sets MANUALLY (after generating c#-code from within Entity Developer) as following: <set name="MietartikelTarifes" inverse="true" generic="true" collection-type="Obi.Persistance.Common.ObservableHashedSetType`1[[MietartikelTarife]], Obi.Persistance">. And it made our day. Perfect. But as we own Entity Developer licence it would the best to generate the collections in mapping of our Entities of type "Obi.Persistance.Common.ObservableHashedSetType`1[[MietartikelTarife]]" BY THE TOOL. How can we achieve this? Is there a solution out there? Have we overseen any buttons / checkboxes? Is there anything we can do more with template files?

Best regards

Vadim

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Change collection-type in .hbm-files?

Post by Shalex » Tue 17 Jun 2014 16:17

Thank you for your suggestion. We will notify you when the possibility of specifying custom collection type name for HibernateRelationProperty via interface of Entity Developer is implemented.

Obi Bieber
Posts: 4
Joined: Thu 12 Jun 2014 12:12

Re: Change collection-type in .hbm-files?

Post by Obi Bieber » Tue 08 Jul 2014 14:17

Dear Sir or Madam,

do you have plans for releasing this feature in the near future? If you do, could you say when it will be released? We really need this feature. We are about to help us only by modifying code manually and this is really annoying and time intense.

Best regards

Vadim

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Change collection-type in .hbm-files?

Post by Shalex » Thu 10 Jul 2014 11:05

We will try to implement the feature before releasing the next public build (in two weeks).

Obi Bieber
Posts: 4
Joined: Thu 12 Jun 2014 12:12

Re: Change collection-type in .hbm-files?

Post by Obi Bieber » Tue 15 Jul 2014 13:18

Sounds good! Thank you!

Kind regards,
Vadim

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Change collection-type in .hbm-files?

Post by Shalex » Thu 31 Jul 2014 16:23

The new (5.7.412) build of Entity Developer is available for download. This version allows to implement the needed functionality in the following alternative ways:

1. Via interface of Entity Developer.
Navigate to Model Settings > Model > Extended Properties > RelationProperty > press Add and set Name=CollectionTypeName, Property Type=System.String > OK.
Now select HibernateRelationProperty, and you will find Collection Type Name in the Extended Properties submenu in the Properties window. Specify the type name. As a result, collection-type="specified_type_name" will be added in the corresponding <set/> section in *.hbm.xml.

2. By modifying template via embedded T4 Editor. Add the following entry in the template:

Code: Select all

<#@ extended name="CollectionTypeName" owner="RelationProperty" type="System.String" description="The assembly-qualified name of the custom collection type." #>
Now select HibernateRelationProperty, and you will find Collection Type Name in the Extended Properties submenu in the Properties window. Specify the type name. As a result, collection-type="specified_type_name" will be added in the corresponding <set/> section in *.hbm.xml.

Obi Bieber
Posts: 4
Joined: Thu 12 Jun 2014 12:12

Re: Change collection-type in .hbm-files?

Post by Obi Bieber » Mon 11 Aug 2014 13:17

Thank you very much! This works very well for us! :D

Kind regards,
Vadim

Post Reply