Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 09, 2012 01:46 AM by BrockAllen
Participant
1465 Points
1147 Posts
Apr 09, 2012 12:10 AM|LINK
Hi
I have this:
public static IMappingExpression<TSource, TDestination> FixRootDest<TSource, TDestination>(this IMappingExpression<TSource, TDestination> mappingExpression) where TDestination : RootDest { mappingExpression.ForMember(dest => dest.Value1, opt => opt.Ignore()); mappingExpression.ForMember(dest => dest.Value2, opt => opt.Ignore()); mappingExpression.ForMember(dest => dest.Value3, opt => opt.Ignore()); mappingExpression.ForMember(dest => dest.Value4, opt => opt.Ignore()); mappingExpression.ForMember(dest => dest.Value5, opt => opt.Ignore()); return mappingExpression; }
However how do i state that both the TSource and the TDesination both inherit from the RootDest
All-Star
27574 Points
4912 Posts
MVP
Apr 09, 2012 01:24 AM|LINK
class Foo<T1, T2>
where T1 : IFoo
where T2 : IBar
{
...
}
Apr 09, 2012 01:44 AM|LINK
Many thanks, don't suppose you have a link to a tutorial or examples on how to do learn more about it?
Apr 09, 2012 01:46 AM|LINK
You mean generics? Sure, here's one.
EnenDaveyBoy
Participant
1465 Points
1147 Posts
I think they called expressions issue
Apr 09, 2012 12:10 AM|LINK
Hi
I have this:
public static IMappingExpression<TSource, TDestination> FixRootDest<TSource, TDestination>(this IMappingExpression<TSource, TDestination> mappingExpression)
where TDestination : RootDest
{
mappingExpression.ForMember(dest => dest.Value1, opt => opt.Ignore());
mappingExpression.ForMember(dest => dest.Value2, opt => opt.Ignore());
mappingExpression.ForMember(dest => dest.Value3, opt => opt.Ignore());
mappingExpression.ForMember(dest => dest.Value4, opt => opt.Ignore());
mappingExpression.ForMember(dest => dest.Value5, opt => opt.Ignore());
return mappingExpression;
}
However how do i state that both the TSource and the TDesination both inherit from the RootDest
BrockAllen
All-Star
27574 Points
4912 Posts
MVP
Re: I think they called expressions issue
Apr 09, 2012 01:24 AM|LINK
class Foo<T1, T2>
where T1 : IFoo
where T2 : IBar
{
...
}
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
EnenDaveyBoy
Participant
1465 Points
1147 Posts
Re: I think they called expressions issue
Apr 09, 2012 01:44 AM|LINK
Many thanks, don't suppose you have a link to a tutorial or examples on how to do learn more about it?
BrockAllen
All-Star
27574 Points
4912 Posts
MVP
Re: I think they called expressions issue
Apr 09, 2012 01:46 AM|LINK
You mean generics? Sure, here's one.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/