howto create xsd from Csla.ReadOnlyBase

howto create xsd from Csla.ReadOnlyBase

Old forum URL: forums.lhotka.net/forums/t/1765.aspx


MvdHoning posted on Wednesday, November 15, 2006

How do i create an xsd directly from an Csla.ReadOnlyBase. Thanks for your answer in advance.

RockfordLhotka replied on Wednesday, November 15, 2006

I suggest that you should not do this. I am assuming your plan is to return the read-only object as the result of a web service, and so you need the xsd? That is a bad idea, because it would tightly couple your external web service interface to your internal implementation - resulting in fragile, hard to maintain code.

What you should so is use the technique I show in Chapter 10, where you define a formal web service interface, along with an associated proxy object (data transfer object (DTO)). Ideally this web service interface would be defined by an xsd, and you'd use a tool to create the proxy object, though in most cases you can get away with creating the proxy object and allowing Visual Studio to create the xsd as part of the wsdl it automatically creates for your web service.

In your asmx code, you load the business object, copy its data to the proxy object and return the proxy object as a result of the web service.

MvdHoning replied on Thursday, November 23, 2006

I need it for crystal reports. I convert de business objects into an dataset that i feed to crystal reports. In order to create the report i need an xsd that resembles the business object(s).

SmeatJones replied on Friday, November 24, 2006

If you put the crystal report in the same project as the business object you can bind the report directly agaisnt the BO with the advantage of re-using the logic.

I'm assuming your are uysing VS 2005

HTH

Smeat

drlargepants replied on Monday, September 10, 2007

How do you then populate the report at runtime, when you bind the report directly to the BO's ?

Copyright (c) Marimer LLC