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: 5,968 | Comments: 44,484

filter by tags archive

What hid under the bed...


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. Pointer arithmetic and dynamic HTML generation FTW–at 2 AM - 41 minutes from now

There are posts all the way to Jul 28, 2015

RECENT SERIES

  1. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
  2. Production postmortem (4):
    23 Jul 2015 - The case of the native memory leak
  3. API Design (7):
    20 Jul 2015 - We’ll let the users sort it out
  4. What is new in RavenDB 3.5 (3):
    15 Jul 2015 - Exploring data in the dark
  5. The RavenDB Comic Strip (3):
    28 May 2015 - Part III – High availability & sleeping soundly
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats