This is a migrated thread and some comments may be shown as answers.

Can a persistent class be an inner class?

4 Answers 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter
Top achievements
Rank 1
Peter asked on 24 Nov 2009, 10:21 AM
Hi

We're implementing a persistent audit trail that has an 'audit' class alongside each domain (business) class.  I'd like to make the audit class an inner class of the domain one, but I can't find a way to set up the OpenAccess (mapping) configuration for an inner class (using the namespace and class elements).  Is it possible?  (Not a problem if it isn't).

Thanks, Peter

4 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 25 Nov 2009, 09:00 AM
Hello Peter,

I am afraid this is not fully supported by the wizards but there is a chance to get it working by editing the mapping configuration manually. Could you please tell us which approach you are using - forward or reverse mapping, so we can test if it is possible and provide you with the steps to achieve it?

Regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Peter
Top achievements
Rank 1
answered on 25 Nov 2009, 11:10 AM
Hello Alexander

We're using forward mapping (actually we generate the mapping configuration - and the persistent classes etc -  from our domain specific language), so no problem with manually setting up the configuration.

Regards, Peter
0
Accepted
Alexander
Telerik team
answered on 25 Nov 2009, 05:09 PM
Hi Peter,

I tested this scenario and it seems to be working fine. The configuration of the nested class is done the same way as the configuration of the outer class. The tricky part though is that in the mapping the name of the nested class is set by concatenating the two class names with a plus (+) sign. For example, if you have ClassA and ClassB (ClassB is nested in ClassA), the mapping would look like this:
<mapping id="mssqlMapping">
    <namespace name="ConsoleApplication1">
      <class name="ClassA+ClassB">
        <extension key="db-table-name" value="ClassB" />
        <!-- manually added -->
        <field name="text">
          <extension key="db-column">
            <extension key="db-column-name" value="Text" />
          </extension>
        </field>
        <!-- end -->
      </class>
      <class name="ClassA">
        <extension key="db-table-name" value="ClassA" />
        <field name="number">
          <extension key="db-column">
            <extension key="db-column-name" value="Number" />
          </extension>
        </field>
      </class>
    </namespace>
</mapping>

The limitation is that the settings for ClassB are not available in the Forward mapping wizard and should be manually added. Please find my test project attached and let us know if you face any difficulties.

Sincerely yours,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Peter
Top achievements
Rank 1
answered on 25 Nov 2009, 06:41 PM
Thank you Alexander - the '+' bit was what I was missing (I couldn't find it the documentation, so you might want to add it for the next update).

Regards, Peter
Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Peter
Top achievements
Rank 1
Share this question
or