Write a method which takes whatever Origin and Destination type is and return a SomeDto?
On Tue, Feb 2, 2010 at 23:00, Tim Scott <[email protected]>wrote: > I have something like this: > > query.Select(x => new SomeDto > { > Id = x.Id, > Destination = new AddressDto > { > Address1 = x.Destination.Address1, > Address2 = x.Destination.Address2, > City = x.Destination.City, > Country = x.Destination.Country, > State = x.Destination.State, > Zip = x.Destination.Zip > }, > Origin = new AddressDto > { > Address1 = x.Origin.Address1, > Address2 = x.Origin.Address2, > City = x.Origin.City, > Country = x.Origin.Country, > State = x.Origin.State, > Zip = x.Origin.Zip > } > }); > > Repetition, yuck. I tried using something like GetAddress > (x.Desitnation), but that doesn't work, and I guess I understand > why. Is there any clever way to DRY this up? > > -- > You received this message because you are subscribed to the Google Groups > "NHibernate Contrib - Development Group" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhcdevs%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhcdevs?hl=en. > > -- You received this message because you are subscribed to the Google Groups "NHibernate Contrib - Development Group" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhcdevs?hl=en.
