using System; using System.Collections.Generic; namespace EGFramework { #region Interface public interface ICommand { void Execute(); } public interface IQuery { TResult Do(); } public interface IEGCQRS { void SendCommand(ICommand command); TResult DoQuery(IQuery query); } #endregion public class EGCQRS :EGModule, IEGCQRS { public void SendCommand(ICommand command) { command.Execute(); } public TResult DoQuery(IQuery query) { return query.Do(); } public override void Init() { } } #region Extension public static class CanSendCommandExtension { public static void EGSendCommand(this IEGFramework self, ICommand command) { EGArchitectureImplement.Interface.GetModule().SendCommand(command); } } public static class CanQueryDataExtension { public static TResult EGQueryData(this IEGFramework self, IQuery query) { return EGArchitectureImplement.Interface.GetModule().DoQuery(query); } } #endregion }