Ayende @ Rahien

Hi!
My name is Ayende Rahien
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,949 | Comments: 44,548

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

No future posts left, oh my!

RECENT SERIES

  1. The RavenDB Comic Strip (3):
    28 May 2015 - Part III – High availability & sleeping soundly
  2. Special Offer (2):
    27 May 2015 - 29% discount for all our products
  3. RavenDB Sharding (3):
    22 May 2015 - Adding a new shard to an existing cluster, splitting the shard
  4. Challenge (45):
    28 Apr 2015 - What is the meaning of this change?
  5. Interview question (2):
    30 Mar 2015 - fix the index
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats