Created
November 22, 2012 11:11
-
-
Save DominicFinn/4130607 to your computer and use it in GitHub Desktop.
Generic Interface Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using TeaLeague.Core.Domain; | |
namespace TeaLeague.Core.Repository | |
{ | |
//What's the best way to approach this, seen as StructureMap seems to have problems with open generics.... | |
//This? | |
public interface IRepository | |
{ | |
IEnumerable<T> List<T>() where T : IEntity; | |
T Get<T>(Guid id) where T : IEntity; | |
void CreateOrUpdate<T>(T user) where T : IEntity; | |
void Delete<T>(Guid id) where T : IEntity; | |
} | |
//Or this? | |
public interface IRepository<T> | |
{ | |
IEnumerable<T> List(); | |
T Get(Guid id); | |
void CreateOrUpdate(T entity); | |
void Delete(Guid id); | |
} | |
} | |
//Might have to do something like this....http://lostechies.com/jimmybogard/2009/12/18/advanced-structuremap-connecting-implementations-to-open-generic-types/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment