Pentru Covariance si Contravariance cititi :http://blogs.msdn.com/b/csharpfaq/archive/2010/02/16/covariance-and-contravariance-faq.aspx
Pentru CQRS cititi http://martinfowler.com/bliki/CQRS.html
Sa presupunem acum ca avem o clasa Implementation si o clasa derivata DerivedImplementation
public interface IFind { } public class Implementation : IFind { } class DerivedImplementation : Implementation { }
In dulcele stil CQRS , avem urmatoarea clasa de Command:
public interface ICommand<T> where T : IFind { bool Update(T t); } public class BaseServiceCommnand<T> : ICommand<T> where T : IFind { public bool Update(T t) { return true; } }
Ce credeti, se compileaza rindul de mai jos:
ICommand<DerivedImplementation> command = new BaseServiceCommnand<Implementation>(); Console.WriteLine(command.Update(new DerivedImplementation()));
Daca nu ( si nu!) ce trebuie adaugat ?
( nu, nu va ginditi la DI / IoC – e acelasi lucru)
Raspuns:
{
؛(ʇ ʇ)ǝʇɐpdn ןooq
}
puıɟı : ʇ ǝɹǝɥʍ
<ʇ uı>puɐɯɯoɔı ǝɔɐɟɹǝʇuı ɔıןqnd
Data viitoare , concluzii