readonly ClientApiTsFunctionGenAbstract apiFunctionGen;         //to be injected in ctor of derived class.

        /// <summary>
        ///
        /// </summary>
        /// <param name="jsOutput"></param>
        /// <param name="apiFunctionGen"></param>
        /// <remarks>The client data types should better be generated through SvcUtil.exe with the DC option. The client namespace will then be the original namespace plus suffix ".client". </remarks>
        protected ControllersTsClientApiGenBase(JSOutput jsOutput, ClientApiTsFunctionGenAbstract apiFunctionGen)
        {
            this.jsOutput       = jsOutput ?? throw new ArgumentNullException("jsOutput");
            this.apiFunctionGen = apiFunctionGen;
            this.apiSelections  = jsOutput.ApiSelections;
            TargetUnit          = new CodeCompileUnit();
            poco2TsGen          = CreatePoco2TsGen();

            TsCodeGenerationOptions options = TsCodeGenerationOptions.Instance;

            options.BracingStyle = "JS";
            options.IndentString = "\t";
            options.CamelCase    = jsOutput.CamelCase ?? false;
        }
        ClientApiTsFunctionGenBase apiFunctionGen; //to be injected in ctor of derived class.

        /// <summary>
        ///
        /// </summary>
        /// <param name="excludedControllerNames">Excluse some Api Controllers from being exposed to the client API. Each item should be fully qualified class name but without the assembly name.</param>
        /// <remarks>The client data types should better be generated through SvcUtil.exe with the DC option. The client namespace will then be the original namespace plus suffix ".client". </remarks>
        protected ControllersTsClientApiGenBase(JSOutput jsOutput, ClientApiTsFunctionGenBase apiFunctionGen)
        {
            if (jsOutput == null)
            {
                throw new ArgumentNullException("jsOutput");
            }

            this.jsOutput       = jsOutput;
            this.apiFunctionGen = apiFunctionGen;
            this.apiSelections  = jsOutput.ApiSelections;
            TargetUnit          = new CodeCompileUnit();
            poco2TsGen          = new Poco2TsGen(TargetUnit);

            TsCodeGenerationOptions options = TsCodeGenerationOptions.Instance;

            options.BracingStyle = "JS";
            options.IndentString = "    ";
            options.CamelCase    = jsOutput.CamelCase.HasValue ? jsOutput.CamelCase.Value : false;
        }
Ejemplo n.º 3
0
        readonly Func <ClientApiTsFunctionGenAbstract> apiFunctionGenFactory;        //to be injected in ctor of derived class.

        /// <summary>
        ///
        /// </summary>
        /// <param name="jsOutput"></param>
        /// <param name="apiFunctionGen"></param>
        /// <remarks>The client data types should better be generated through SvcUtil.exe with the DC option. The client namespace will then be the original namespace plus suffix ".client". </remarks>
        protected ControllersTsClientApiGenBase(Settings settings, JSOutput jsOutput, Func <ClientApiTsFunctionGenAbstract> apiFunctionGenFactory)
        {
            this.settings = settings;
            this.jsOutput = jsOutput;
            this.apiFunctionGenFactory = apiFunctionGenFactory;
            CodeCompileUnit            = new CodeCompileUnit();
            nameComposer = new NameComposer(settings);

            TsCodeGenerationOptions options = TsCodeGenerationOptions.Instance;

            options.BracingStyle = "JS";
            options.IndentString = "\t";
            options.CamelCase    = true;


            var versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);

            ProductName = versionInfo.ProductName;
        }