Can I make a WCF service with a DataContract hierarchy?

I have a Silverlight application with a web site application. I make two classes something like this:

type
[DataContract]
[KnownTypes( typeOf( Class2 ) )]
Class1 = public class( Class2 )

end;

[DataContract]
Class2 = public class

end;

The class Class 1 is used directly in the service.

The generate code out of slSvcUtil gives something like this (amongst other things):

[System.Diagnostics.DebuggerStepThroughAttribute]
[System.CodeDom.Compiler.GeneratedCodeAttribute(‘System.Runtime.Serialization’, ‘4.0.0.0’)]
[System.Runtime.Serialization.DataContractAttribute(Name := ‘Class1’, &Namespace := ‘http://schemas.datacontract.org/2004/07/Guardian.Scheduler.DataContracts’)]
Guardian.Scheduler.DataContracts.Class1 = public partial class(Guardian.Scheduler.DataContracts.Class2)

When I try to compile with the generated code, I get:

Error 1 (PE47) Cannot implement non interface type “Guardian.Scheduler.DataContracts.Class2” C:\Users\mtiede\Documents\Visual Studio 2010\Projects\SW\GuardianScheduler\GuardianScheduler\GuardianSchedulerService.pas 1803 77 GuardianSchedulerViewModels

Looks like it thinks the only thing allowed in the class( … ) is an interface. Is this an Oxygene compiler problem, or is there something wrong with the generated code?

(as a separate question, how to I mark this up so that the code looks different than my question? I don’t see any mark-up tags as help anywhere)

Here’s all the versions of everything:

Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework
Version 4.0.30319 SP1Rel

Installed Version: Professional

Microsoft Office Developer Tools 01018-532-2002102-70042
Microsoft Office Developer Tools

Microsoft Visual Basic 2010 01018-532-2002102-70042
Microsoft Visual Basic 2010

Microsoft Visual C# 2010 01018-532-2002102-70042
Microsoft Visual C# 2010

Microsoft Visual C++ 2010 01018-532-2002102-70042
Microsoft Visual C++ 2010

Microsoft Visual F# 2010 01018-532-2002102-70042
Microsoft Visual F# 2010

Microsoft Visual Studio 2010 Team Explorer 01018-532-2002102-70042
Microsoft Visual Studio 2010 Team Explorer

Microsoft Visual Web Developer 2010 01018-532-2002102-70042
Microsoft Visual Web Developer 2010

AnkhSVN - Subversion Support for Visual Studio 2.1.8420.8
AnkhSVN - Subversion Support for Visual Studio 2.1.8420.8

  • Ankh.Package 2.1.8420.8
  • Subversion 1.6.11 via SharpSvn 1.6011.1539.9366

SharpSvn is linked to: Apr 1.3.12, Apr-util 1.3.9, Neon 0.29.3, OpenSSL 1.0.0 29 Mar 2010, serf 0.3.1, SQLite 3.6.23, Subversion 1.6.11-SharpSvn-tag-1.6.11@936627, ZLib 1.2.4
SharpSvn is dynamically linked to: Cyrus Sasl 2.1.23
SharpSvn is optionally linked to: Berkeley DB 4.4.20, SharpPlink 1.6011.1539.9366

Crystal Reports Templates for Microsoft Visual Studio 2010
Crystal Reports Templates for Microsoft Visual Studio 2010

ECO Visual Studio integration 6.0
Visual Studio integration for ECO

Embarcadero Delphi Prism 4.0.27.843
Embarcadero Delphi Prism
Powered by the RemObjects Oxygene Compiler
Copyright © 2008-2010 Embarcadero Technologies, Inc. All rights reserved.
All Embarcadero brand and product names are trademarks or registered trademarks of Embarcadero Technologies, Inc. in the United States and other countries. Oxygene is a trademark of RemObjects Software, LLC in the United States and other countries. All other marks are the property of their respective owners.

Dedicated to Rick Wright (1943-2008).
Enjoy the Great Gig in the Sky.

Entity Framework 4.1 Power Tools 1.0
Adds useful design-time DbContext features to the Visual Studio Solution Explorer context menu.

When right-clicking on a file containing a derived DbContext class, the following context menu functions are supported:

  1. View Entity Data Model - Displays the underlying Code First model in the Entity Framework designer.
  2. View Entity Data Model XML - Displays the EDMX XML representing the underlying Code First model.
  3. Optimize Entity Data Model - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project.

Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2522890) KB2522890
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2522890.

Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2529927) KB2529927
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2529927.

Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2548139) KB2548139
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2548139.

Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2549864) KB2549864
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2549864.

Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2565057) KB2565057
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2565057.

Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2635973) KB2635973
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2635973.

Microsoft Visual Studio 2010 Professional - ENU Service Pack 1 (KB983509) KB983509
This service pack is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/983509.

Microsoft Visual Studio 2010 SharePoint Developer Tools 10.0.40219
Microsoft Visual Studio 2010 SharePoint Developer Tools

Modlr - the ECO design surface 1.0
Modlr - the ECO design surface

NuGet Package Manager 1.4.20615.9020
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Oracle Developer Tools for Visual Studio 11.2.0.1.2
Oracle Developer Tools for Visual Studio Copyright © 2005, 2010

RemObjects Everwood 3.0.17.257
RemObjects Everwood for .NET
Copyright 2003-2010 RemObjects Software, LLC. All rights reserved.
http://www.remobjects.com/everwood

RemObjects Oxygene 4.0.27.843
RemObjects Oxygene
Copyright 2003-2011 RemObjects Software, LLC. All rights reserved.
http://www.remobjects.com/oxygene

Security Update for Microsoft Visual Studio 2010 Professional - ENU (KB2645410) KB2645410
This security update is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this security update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2645410.

StarTeam 2009 R2 for Visual Studio Version: 11.0.0.16
StarTeam® 2009 R2 Visual Studio® Integration provides ALM support for for Microsoft® Visual Studio®. http://www.borland.com Copyright © 1998-2010 Borland (A Micro Focus Company). All rights reserved. This product may be covered by U.S. Patents pending.

VisualStudioIntegration2010 1.0
Information about my package

VMDebugger
For more information about VMware Inc, see their website at


Copyright © 2010 VMware, Inc.

Hello.

Could you please provide us with a simple testcase that demonstrates a problem? A simple WCF service and a generated proxy file so we can reproduce a problem.

You can use next tags to markup the oxygene code:

 < /pre>

Thanks in advance.

Did I miss something somewhere that described the tags that can be used?

Our forum allows some general html tags (pre, a, h1, font, b), the ones that are not disrupted. Full list of languages for “pre” tag is here http://qbnz.com/highlighter/ .

In trying to create a sample, I AM able to do the inherited DataContracts. But not in my real solution. Not sure what is different. Looking for differences now.

So far I haven’t spotted anything different. The generated code for Class1 and Class2 look the same as my production application, but the test one compiles the generated code all right, but the production generated code doesn’t compile. Maybe there is something about the number of classes or the size of them or something else.

Does anyone have any suggestions how that error message could be generated. I would think you could look up in the compiler as to what cases cause that error.

Hello,

Sorry for the delay. Could you please attach here the generated file or send it to support@remobjects.com so we can test it?

Thanks in advance.

I will try to get to it later. Kind of busy for the rest of this week. In order to generate the error, I have to change code around and I can’t be doing that at the moment. Hopefully, in about 2 weeks I’ll be able to post something again.