Ayende @ Rahien

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

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 18 | Comments: 87

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()

Comments

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

Rytmis

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" :)

Vladan

l0t3k

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.

FUTURE POSTS

  1. Buffer allocation strategies: A possible solution - about one day from now
  2. Buffer allocation strategies: Explaining the solution - 3 days from now
  3. Buffer allocation strategies: Bad usage patterns - 4 days from now
  4. The useless text book algorithms - 5 days from now
  5. Find the bug: The concurrent memory buster - 6 days from now

There are posts all the way to Sep 11, 2015

RECENT SERIES

  1. Find the bug (5):
    20 Apr 2011 - Why do I get a Null Reference Exception?
  2. Production postmortem (10):
    03 Sep 2015 - The industry at large
  3. What is new in RavenDB 3.5 (7):
    12 Aug 2015 - Monitoring support
  4. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats