コード例 #1
0
        private void RegisterTestCommands()
        {
            var instance = m_Context.Resolve <TestCommands>();

            var map = CommandMapper <ITestCommandSet> .Create();

            map.From <string, int, int>((command, name, retry, timeout) => command.Echo(name, retry, timeout))
            .To((EndpointId e, string n) => instance.Echo(e, n));

            map.From <int, int>((command, first, second) => command.Calculate(first, second))
            .To((int first, int second) => instance.Calculate(first, second));

            map.From <UploadToken>((command, token) => command.StartDownload(token))
            .To((EndpointId e, UploadToken t) => instance.StartDownload(e, t));

            var collection = m_Context.Resolve <RegisterCommand>();

            collection(
                map.ToMap(),
                m_Subjects.Select(s => new SubjectGroupIdentifier(s, new Version(1, 0), "a")).ToArray());
        }