Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,007 | Comments: 44,760

filter by tags archive

What hid under the bed...

time to read 1 min | 118 words

public class ARValidatingAuthorizationRepository<TIEntityType, TIUsersGroup, TIEntitiesGroup, TIOperation, TIEntityReference, TIPermission>     
  :  RhinoAuthorizationRepository< TIEntityType, TIUsersGroup, TIEntitiesGroup, TIOperation, TIEntityReference, TIPermission> 
      where TIEntityType : class, IEntityType, new()
      where TIUsersGroup : class, IUsersGroup, new()
      where TIEntitiesGroup : class, IEntitiesGroup, new()
      where TIOperation : class, IOperation, new()
      where TIEntityReference : class, IEntityReference, new()
      where TIPermission : class, IPermission, new()


Chad Myers

We might have to revoke your Generics License for that one.

Jason Olson

Holy Generics, Batman!!!! :P

Frans Bouma

whoa :D

What's even more funny, all types have an interface, so the method also could have just used the interfaces and it would still be a generic method


Frans: Except that interfaces don't allow constructor definitions, but the generics constraints can demand that the type have a zero-argument public ctor.

Vladan Strigo

Maybe a new smell should be named... "Generics explosion" :)



Ya know, thats exactly the reason i never got into the C++ STL, but strangely i have less of a problem with this...

Jeremy D. Miller

I don't want to play oneupsmanship here, but as soon as I finished this code I knew I needed to post this here:

public abstract class CrudController<DomainModel, ToViewModel, FromViewModel, THIS>

    where DomainModel : DomainEntity, new()

    where ToViewModel : ViewInputModel<THIS>, new()

    where FromViewModel : ViewModel

    where THIS : CrudController<DomainModel, ToViewModel, FromViewModel, THIS> 
Joe Reddy

Good grief.

You do this kind of stuff on purpose?

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Speaking (3):
    23 Sep 2015 - Build Stuff 2015 (Lithuania & Ukraine), Nov 18 - 24
  2. Production postmortem (11):
    22 Sep 2015 - The case of the Unicode Poo
  3. Technical observations from my wife (2):
    15 Sep 2015 - Disk speeds
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats