Nullable type and entity translator

Topics: July and December Releases Forum
Jan 24, 2007 at 3:44 PM
We created a business entity from database table, which includes quite a few nullable columns. We tried to create a translator class for this business entity and a data contract class, but most of fields are not mappable, because a lot of properties in the business entity are Nullable. Is there any easy work-around?

I understand that recipes can be customized. I'd like to explore that option. Is there any tutorial for customizing existing recipes in service factory?
Jan 24, 2007 at 5:09 PM
On your first point, it sounds like you've realized that nullable fields are only mappable one way. For mapping the other way, you'll have to write it by hand.

We don't have any tutorials available today, but we do have a hands-on lab (HOL) exercise being created that will illustrate how to make certain changes to the guidance packages.

If you would like to influence how the translators are generated, this is relatively easy. Have a look at this file: "C:\Program Files\Microsoft Service Factory\WCF Guidance Package\Templates\T4\TypeTranslator.t4" If you've written Classic ASP, or similar types of files, this file will look intuitive. T4 template changes don't even require reinstalling the guidance package. You just have to restart Visual Studio.

Hope this helps,
Jan 25, 2007 at 7:50 PM
Thank you, Don. I modified that t4 and it worked. BTW, love your blog and webcast. Do you have any plan to do more webcasts about service factory edit?

Thanks again.
Jan 25, 2007 at 7:58 PM
Thanks. As a matter of fact I just got my machine (now Vista) set up with Camtasia and my shiny new LifeCam camera (yes, I might have to show my ugly mug in the next video :) So, I'm all set up to do more blogcasts.

Also, I saw an early feature from the CodePlex team yesterday. Yep, I'll be hosting all the new videos here ... and I'll just link to them from my blog.

And since we're talking about using technology in interesting ways. I have an idea about how to keep all of you aware of the v3 progress. Keep your eye on the v3 project status page :)

Jan 25, 2007 at 11:52 PM
Can't wait, Don.

In your blog, you mentioned Recipe runner once, is that out yet?

Jan 26, 2007 at 2:03 AM
Your timing for that question could not be more perfect. I just spoke with Larry, who has been doing the work to get that ready, and he as assured me that will be available here on the community site within a week. Thanks!

Jan 26, 2007 at 3:19 AM
That is awesome. Thanks.

This is probably a little bit off the topic. But since we are already talking about modifying recipes... I noticed that you mentioned in another post that Wizard cannot be resized due to the limitation of GAX. We plan to modify the type translator so that more than two classes can be involved - it's not really a translator, but more of an "assembly line". Do you think it's possible to modify that mapping dialog to hold more classes?
Jan 26, 2007 at 9:10 PM
Trying to change the size of the wizard page might be a bit tricky at first glance but you have a couple of attributes "width" and "height" in the page element of the recipe that allows you to change the wizard size. However, in practice you may not get the expected result since GAX (or more precisely VS API will handle all the page sizes but since you got a custom page, then you may resize that page in order to fit all your controls. If you do this, you should take care not to overload the page with controls since you may end up with a page long enough that may not fit in most of the visible screen resolution. Let me know if you have any trouble resizing that page.

Jan 26, 2007 at 9:34 PM
Thanks, will let you know the result.