Пример #1
0
        protected static string RepositoryFunctionsSnippet(ActionInfo info)
        {
            // Using nonstandard naming of variables to avoid name clashes with injected code.
            return string.Format(
        @"public void Execute({0}.{1} actionParameter)
        {{
            Action<{0}.{1}, Common.DomRepository, IUserInfo{3}> action_Object = {2};

            {5}
            action_Object(actionParameter, _domRepository, _executionContext.UserInfo{4});
            {6}
        }}

        void IActionRepository.Execute(object actionParameter)
        {{
            Execute(({0}.{1}) actionParameter);
        }}

        ",
            info.Module.Name,
            info.Name,
            info.Script,
            DataStructureUtility.ComputationAdditionalParametersTypeTag.Evaluate(info),
            DataStructureUtility.ComputationAdditionalParametersArgumentTag.Evaluate(info),
            BeforeActionTag.Evaluate(info),
            AfterActionTag.Evaluate(info));
        }
Пример #2
0
        protected static string RepositoryFunctionsSnippet(ActionInfo info)
        {
            return string.Format(
@"        private static readonly Action<{0}.{1}, Common.DomRepository, IUserInfo{3}> _action = {2};

        public void Execute({0}.{1} actionParameter)
        {{
            {5}
            _action(actionParameter, _domRepository, _executionContext.UserInfo{4});
            {6}
        }}

        void IActionRepository.Execute(object actionParameter)
        {{
            Execute(({0}.{1}) actionParameter);
        }}

",
            info.Module.Name,
            info.Name,
            info.Script,
            DataStructureUtility.ComputationAdditionalParametersTypeTag.Evaluate(info),
            DataStructureUtility.ComputationAdditionalParametersArgumentTag.Evaluate(info),
            BeforeActionTag.Evaluate(info),
            AfterActionTag.Evaluate(info));
        }
 private static string ImplementationCodeSnippet(ActionInfo info)
 {
     return String.Format(
     @"
     [OperationContract]
     [WebInvoke(Method = ""POST"", UriTemplate = ""/{0}/{1}"", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
     public void Execute{0}{1}({0}.{1} action)
     {{
     var commandInfo = new ExecuteActionCommandInfo {{ Action = action }};
     var result = _serverApplication.Execute(ToServerCommand(commandInfo));
     CheckForErrors(result);
     }}
     ", info.Module.Name, info.Name);
 }
Пример #4
0
        protected static string RepositoryFunctionsSnippet(ActionInfo info)
        {
            return string.Format(
            @"        private static readonly Action<{0}.{1}, Common.DomRepository, IUserInfo{3}> _action = {2};

            public void Execute({0}.{1} parameters)
            {{
            _action(parameters, _domRepository, _executionContext.UserInfo{4});
            }}

            void IActionRepository.Execute(object parameters)
            {{
            Execute(({0}.{1}) parameters);
            }}

            ",
             info.Module.Name,
             info.Name,
             info.Script,
             DomUtility.ComputationAdditionalParametersTypeTag.Evaluate(info),
             DomUtility.ComputationAdditionalParametersArgumentTag.Evaluate(info));
        }
Пример #5
0
 public static string RegisterRepository(ActionInfo info)
 {
     return string.Format(@"builder.RegisterType<{0}._Helper.{1}_Repository>().Keyed<IActionRepository>(""{0}.{1}"").InstancePerLifetimeScope();
     ", info.Module.Name, info.Name);
 }