How to: Is there a way to create Data Types from BusinessEntites?

Topics: General Discussion Forum, July and December Releases Forum, Service Factory Modeling Edition Forum
Mar 7, 2007 at 9:07 PM
I am using the ASMX Service factory to build a webservice front end to my database. There is no existing code. I have walked through the factory automation steps to create all of my Business Entities but I am not able to move on to the Service Contract creation steps with out creating Data Types first. Is there an automated way in the Service Factory to create Data Types from Business Entities?
Mar 7, 2007 at 10:16 PM
There's no recipe in the guidance packages that creates Data Types from Business Entities.
In fact, this is by design, since it enforces the guideliness of the prescriptive architecture in WSSF that doesn't allow business entities to be exposed across service boundaries, therefore, you need to define the various data types you use to construct messages.
You also have support for schema-first design scenarios with the recipe "Create data type from schema" so you may desing your schemas and create from there instead of creating the datatypes one by one using the former recipe.

For further info on how to use the WSSF, take a look at this article Web Service Software Factory in MSDN magazine.

Mar 7, 2007 at 11:05 PM
Thanks for the feedback Charly.

The feature seemed suspiciously absent so I’m not surprised by your response.
It seems to me that there is a valid case for creating Data Types from Business entities; specifically, as a first step to implementing the Service Architecture in a legacy environment. In my case, I am working with a database that has grown over the years to serve our business needs. Its schema is authoritative. I want to create the Data Types from our business entities (which were created from the database schema) because I want a starting point for implementing the Service Model. Ideally, after having migrated legacy apps to the Service (which should not be hard because the schema would not have changed) we would be in a good position to implement changes to our database or architecture in general because we could simply modify the Data Type to Entity Translators at the Service Contract Translators level. From this perspective, it seems practical to allow the database schema to define Data Types when running the Service Factory.

1. I used the “Create Business Entities from Database” recipe to create my business entities.
2. I used the xsd.exe tool to generate the schema from the newly created business entities assembly.
3. I used the “Create Data Types from Schema” recipe to create my Data Types.

Any thoughts?
Mar 8, 2007 at 5:09 PM
I agree with you regarding the idea of this kind of "temporary" migration stage. However, I don't see any constrain about why you can't create Data Types out of your current business entities. Nevertheless I think that your workaround is pretty good and considering what we have been discussing.

Nice work!
Keep on with this great feedback!