New XAG Feature - Simplified DTO Creation
After finishing up the first CTP of Minima I have to say that creating my own objects for data transfer (called DTOs - Data Transfer Objects) is painfully lame and using XAG to create an entire projet every thing is a bit overkill. So, I added a middle ground feature into XAG to allow all of us to very efficiently generate DTOs.
So, now, you can go to XAG, select the DTO Class Template (or write your own), select "Single Type Only" and it will show you the class ON SCREEN in a text area for easy copy/paste into your own project. This should make data transfer in the pre-C# 3.0 world MUCH easier.
Here's an example of what you can do.... you simply put the following in (you could have XAG put the DataContract and DataMember attributes on there too-- see the XAG WCF template), select Single Type Only mode, hit Create, and you get the below code instantaneously on the screen. I've been an advocate of AJAX for 8 years now and this should serve as an example of why you should use it too. Link to XAG is below.
<Assembly xmlns:x="http://www.jampadtechnology.com/xag/2006/11/"> <Person x:Key="Person" Type="Class" AutoGenerateConstructorsByProperties="True" AccessModifier="Public" Namespace="AcmeCorp.Sales"> <Properties> <FirstName Type="String" /> <LastName Type="String" /> <Address1 Type="String" /> <Address2 Type="String" /> <City Type="String" /> <State Type="String" /> <PostalCode Type="String" /> </Properties> </Person> </Assembly>
using System; using System.Runtime.Serialization; namespace AcmeCorp.Sales { public class Person { private String firstname; private String lastname; private String address1; private String address2; private String city; private String state; private String postalcode; public String FirstName { get { return firstname; } set { firstname = value; } } public String LastName { get { return lastname; } set { lastname = value; } } public String Address1 { get { return address1; } set { address1 = value; } } public String Address2 { get { return address2; } set { address2 = value; } } public String City { get { return city; } set { city = value; } } public String State { get { return state; } set { state = value; } } public String PostalCode { get { return postalcode; } set { postalcode = value; } } public Person(String firstName, String lastName, String address1, String address2, String city, String state, String postalCode) { this.FirstName=firstName; this.LastName=lastName; this.Address1=address1; this.Address2=address2; this.City=city; this.State=state; this.PostalCode=postalCode; } public Person( ) { } } }
Links